The kings of old who brought about fairness and justice in their kingdoms were called righteous. When the right was not present, the people longed for a king who would rescue (save) them from unrighteousness and reestablish equity in the kingdom. Jesus is that rescuing king (Zec 9:9). “Great and marvelous are Your works, O Lord God, the Almighty; Righteous and true are Your ways, King of the nations!” (Rev 15:3b NASB). We worship our king by doing righteousness (Isa 58:6-7).
“Behold, the days come, saith the LORD, that I will raise unto David a righteous Branch, and a King shall reign and prosper, and shall execute judgment and justice in the earth.” Jeremiah 23:5 (KJV)