Writing a problematic main character

What advice would you give on writing a character with problematic decision making. Even though the basis of their decisions is understood the consequences of their actions are pretty bad. How would you make a character like that likeable?