Most limits are self imposed.
Some consciously, some unconsciously.
But most without a second thought to see if they are reasonable.
"When law and morality contradict each other, the citizen has the cruel alternative of either losing his moral sense or losing his respect for the law." - C. F. Bastiat
And in fact there is a third choice, the mores of your area or tribe may contradict both law and morality.
That is when it is nice to be a human.
We have the ability to think, and to act or not act, based on thought, - not these conflicting limits.
Often it is better to move to an area where your morals line up with local laws and mores.
Thought combined with action will prevent you from having to say "I was just following orders."
Know your limits, define them for yourself, examine any limits that are forced on you.
To your own self be true.
Give every man thy ear, but few thy voice;William Shakespeare
Take each man's censure, but reserve thy judgement.
Costly thy habit as thy purse can buy,
But not express'd in fancy; rich, not gaudy;
For the apparel oft proclaims the man;
And they in France of the best rank and station
Are of a most select and generous chief in that.
Neither a borrower, nor a lender be;
For loan oft loses both itself and friend,
And borrowing dulls the edge of husbandry.
This above all: to thine own self be true,
And it must follow, as the night the day,
Thou canst not then be false to any man.
Farewell; my blessing season this in thee!