The word ok seems to imply a moral question. I do think there are cases where you have to break the law in order to make a moral decision. You have to have a higher conscience. The law cannot see every possibility, and is intentionally over-arching. People have to make their own choices and be willing to accept the consequences.
One must live by the dictates of conscience, act accordingly, and accept the consequences. That includes adherence or rejection of law. It is possible, in the US, to break a law, be brought to trial, and still be acquitted, but only if the jury feels the law is bad, in which case it can be removed from the books, or nullified.
From Civil Disobedience, courtesy of Henry David Thoreau (1817-1862):
Unjust laws exist: shall we be content to obey them, or shall we endeavor to amend them, and obey them until we have succeeded, or shall we transgress them at once? Men, generally, under such a government as this, think that they ought to wait until they have persuaded the majority to alter them. They think that, if they should resist, the remedy would be worse than the evil. But it is the fault of the government itself that the remedy is worse than the evil. It makes it worse. Why is it not more apt to anticipate and provide for reform? Why does it not cherish its wise minority? Why does it cry and resist before it is hurt? Why does it not encourage its citizens to put out its faults, and do better than it would have them? Why does it always crucify Christ and excommunicate Copernicus and Luther, and pronounce Washington and Franklin rebels?
I agree with the first response. It can be morally right to break an immoral law, although of course one must accept the consequences of breaking the law. The best option is to try to change the law before breaking it, but history is full of highly ethical people who disobeyed unethical laws -- laws that were later repealed partly because they had been broken by people who answered a "higher law."
People can disagree on this issue, but my view of the matter is that it is permissible to break the law in certain instances. (I am assuming that we are talking about breaking the law in a democratic society.)
First, the way in which one breaks the law must not hurt other people. Breaking the law by stealing from others or by assaulting others is never acceptable.
Second, one must be breaking the law for the correct reasons. A person must break the law not because it is convenient to do so, but because they sincerely believe the law is unjust.
Finally, they must be willing to take the consequences of breaking the law. If you truly believe the law is wrong, you should break it in a public way so that people can see what you are doing. You should then prove your sincerity by taking the punishment for your actions.
If all of these criteria are met, breaking the law is acceptable.
if it is purposely no if it is by accident yes