unjust law is no law at all (in Latin: lex iniusta non est lex)

expression supporting natural law acknowledging that authority is not legitimate unless it is good and right

Woe to those who make unjust laws,
to those who issue oppressive decrees,
to deprive the poor of their rights
and withhold justice from the oppressed of my people — Isaiah 10 (Tanakh or The Old Testament)

Augustine of Hippo said “for I think a law that is not just, is not actually a law” (“nam mihi lex esse non videtur, quae justa non fuerit”) while discussing the problem of evil

Thomas Aquinas refers to Isaiah 10 in Summa Theologica - are man-made laws to be obeyed? No. Unless they are legitimate in three ways: The Purpose: The law must be for the common good. The Author: It must be in the scope of the authority making the law. The Form: And its burden should be equal and apply to all.