The law is quite simple is understand. It is that men have common goals which are the objects of their rational will, that the state is a contrivance that they have worked out to help them realize that end, and that its authority over them rests on its being necessary for that end. If it is politically obligatory at times to obey a law that one regards as bad, that is because the state could not be run at all if the citizens could pick and choose which laws they would obey. Ultimately, therefore, political obligation, even that of obeying a morally bad law, is a moral obligation; and when, as occasionally happens, it becomes a duty to disobey, the ground is still the same. I believe that this simple doctrine is what the Gemara and all the rishonim [medieval authorities] are saying. [Credit goes to Reb Moshe Feinstein and Reb Aaron Kotler who both pointed out the connection between the State of Israel the statement of Shmuel in the Talmud.]
The religious world assumes if they were in charge then everything would be peachy. This is not true. I have never seen any situation in which religious people got involved in that they did not make it a thousand times worse. Whatever Torah they think they are keeping it is certainly not the Torah from the realm of Holiness.
Does it follow that since the state is a necessary means to our major ends, we should in all circumstances obey it, that we never have the right to rebel? Not at all. Our view would not only justify disobedience in some cases; it would require it. If the state is regarded, not as sacrosanct or an end in itself, but as an instrument to certain great ends, then when it becomes so corrupt as to cut us off from those ends rather than further them, when it serves its purpose so badly that it is better to risk chaos for the sake of a better order than continue to suffer under the old, then resistance becomes a right and a duty.
This will be an extreme and desperate case, since it will obviously be better as a rule to obey what we regard as a bad law and try by persuasion to get it amended than to seek the overthrow of the power which supports all laws alike.
But there is no doubt that when government has ceased to serve its major ends, the people who have fashioned it to serve those ends have a right to replace it with something that serves these better.