He was willing to be killed until it meant his friends would be killed too. What's so hard to understand about that?
Loving the princess though. Smart, cunning, sadistic, arrogant, strong willed, but tempered by a sense of justice. She does not deceive herself.