In general the leadership of nations reflects the morality of it's citizens in general. Leaders can be blessings or judgments upon nations. I fear as a nation were learning that the hard way. When was the last time our nation had a leader respected by the world and the United States enjoyed prosperity? It ain't been that long ago. Clue: He didn't go a calling on any Log Cabin for support. The nation at that time had turned it's attention back toward GOD. The end result changed the layout of several nations for the better and saw the collapse of a Communist Empire.
The answer in short is this. GOD who protects the righteous leaders from harm when He has blesses a nation can also keep the not so righteous in office for ones who are opposing Him.