If a law is unjust, a man is not only right to disobey it, he is obligated to do so.
Source, in full
Not attributed to Jefferson until the 21st century. May be a loose paraphrasing of a passage from Declaration of Independence (1776): "But when a long train of abuses and usurpations, pursuing invariably the same Object evinces a design to reduce them under absolute Despotism, it is their right, it is their duty, to throw off such Government, and to provide new Guards for their future security."
Variants
When injustice becomes law, resistance becomes duty. || When tyranny becomes law, rebellion becomes duty.