If you use King David as an example of why personal morality does not matter in a nation’s leader, you are spreading heresy and you need to repent.
God severely judged David for his sin. David’s newborn died as a judgment from God. Later, David was overthrown and forced to flee Jerusalem by his own son Absalom, who then had sex with David’s wives and concubines on the roof of David’s own palace. David was humiliated, and pleaded with God for forgiveness.
The Old Testament is filled with examples of God’s prophets rebuking the kings of Israel and Judah for their sin and calling them to repentance. God judged Moses for his disobedience, refusing to let him enter the promised land. Lest you think that this only applies to Israel, the prophets also condemned pagan nations for their sin, including brutality against their neighbors. One specific example is Nebuchadnezzar.
This is not confined to the Old Testament, as John the Baptist rebuked King Herod for his sexual immorality. The pharisees had civil authority in addition to religious authority and were rebuked repeatedly by Christians. Romans 13 sets up the ideal standard as a king who serves God as “a revenger to execute wrath upon him that doeth evil.” (The word “king” applies to the civil magistrate in any form of government.) The Apostle Paul used his Roman citizenship to thwart the local authorities who persecuted him.
Christians used to understand that our leaders should be moral people. It is sad that so much of Christiandom has abandoned this basic standard from Holy Scripture.