The word righteous comes from the old Norse word rettviss and the old English word rihtwis, both of which mean “just, upright, virtuous.” This meaning has been carried into the modern English words righteous and righteousness, although nowadays those words have strong religious connotations because they are usually used to translate the Hebrew word tzedek.
Tzedek is a common word in the Hebrew Bible, often used to describe people who act in accordance with God’s wishes, but it is also an attribute of God and of God’s judgment of people (which is often harsh but always thought to be just). The linkage of righteousness and judgmentalism is captured in some modern definitions of righteous, such as “arising from an outraged sense of justice, morality, or fair play.” The link also appears in the term self-righteous, which means “convinced of one’s own righteousness, especially in contrast with the actions and beliefs of others; narrowly moralistic and intolerant.”
Jonathan Haidt, The Righteous Mind, Knopf Doubleday Publishing Group.