It is said in the Doctrine and Covenants, that he that keepeth the laws of God, hath no need to break the laws of the land [D&C 58:21]. It is further explained in section 98 [D&C 98], what is meant in relation to this. That all laws which are constitutional must be obeyed, as follows:

“And now, verily I say unto you concerning the laws of the land, it is my will that my people should observe to do all things whatsoever I command them.

“And that the law of the land which is constitutional, supporting that principle of freedom in maintaining rights and privileges, belongs to all mankind, and is justifiable before me;

“Therefore I the Lord justify you and your brethren of the Church in befriending that law which is the constitutional law of the land. And as pertaining to laws of man, whatsoever is more or less than these cometh of evil” [D&C 98:4–7].

That is taking this nation as an example, all laws that are proper and correct, and all obligations entered into which are not violative of the constitution should be kept inviolate. But if they are violative of the constitution, then the compact between the rulers and the ruled is broken and the obligation ceases to be binding. Just as a person agreeing to purchase anything and to pay a certain amount for it, if he receives the article bargained for, and does not pay its price, he violates his contract; but if he does not receive the article he is not required to pay for it.

( Source: Journal of Discourses 26:350 )