Legality does not transform that which is immoral into that which is moral or just.
Likewise, illegality does not turn that which is moral into something immoral.
There is nothing virtuous about obeying, enforcing, or advocating for immoral, illegitimate, unjust laws.
Yet we see countless examples of people, in the name of legality and illegality, attempting to supplant morality. While they may be successful in carrying out their agenda due to an implicit or explicit threat of coercion or violence, their actions can’t change the nature of morality.
Morality transcends and precedes “laws” written by men. Is there a piece of legislation, a regulation, a prohibition, or a redistribution scheme written by legislators or “authorities” that does not violate the rights of one in order to benefit another? I can’t think of one.
In evaluating whether a law is moral or immoral, we must begin with the foundational principle that each individual is the sole owner of his life.
You own yourself. No one else owns you and you do not own another. That means that your property – what you produce, save, purchase, and the wages you exchange for your labor – is yours alone. You are the sole owner of it. You are the only person who can legitimately decide how your property is used. You may choose to save, spend, invest, and give charitably in proportions that you determine are in your best interest or are in line with your preference. But for your property to be taken or used without your consent for any reason, even a charitable one, it would have to be stolen first.
You also own your physical body. You are responsible for what you do with it, risks you take, and choices you make. When someone else uses the threat of violence to make you do something with your own body or violently prohibits you from doing something with your own body, they are asserting illegitimate ownership over you. That is immoral. Of course, each individual is responsible for the consequences of the lifestyle choices he makes.
Just as you own your own life, you own no one else’s. You are neither morally obligated nor permitted to assert ownership over someone else’s property or physical body, even upon direction to do so from an “authority”. You are morally prohibited from violating the rights of others because a “law” directs you to do so.

“There is in all of us a strong disposition to believe that anything lawful is also legitimate. This belief is so widespread that many persons have erroneously held that things are ‘just’ because law makes them so.” Frederic Bastiat
http://www.fee.org/files/doclib/20121116_TheLaw.pdf
I am intentionally not writing about a particular issue here. I don’t have to. This principle applies to all issues. It is when people start making excuses for violating this principle for their pet issues that we run into trouble. When we apply this principle, the hypocrisy and inconsistency of people who hide behind legality and illegality as they advocate for the use of force against others is exposed. Be consistent.
You own yourself, so live like you do.
You do not own others, so stop using the “law” to control others.
This is the way to a more virtuous and free society.