Under normal circumstances it would be, but under circumstances in which one's rights are threatened it becomes irrelevant. For example, under normal circumstances it would be immoral to trespass onto someone's property, but if I were being chased by a killer I would be perfectly justified in hiding on that property without the owner's consent.