Joseph Smith (specifically prohibited from performing the ceremony by the local county court) married Newell Knight (recently widowed) to Lydia G. Bailey. A state licensed Mormon Elder was available to do the marriage. Lydia was not divorced from her non-Mormon husband at the time. Newell wrote in his journal that Joseph Smith said "I have done it by the authority of the holy priesthood and the Gentile law has no power to call me to account for it. It is my religious privilege, and even the Congress of the United States has no power to make a law that would abridge the rights of my religion."
Lydia remembered Joseph saying, "Our Elders have been wronged and prosecuted for marrying without a license. The Lord God of Israel has given me authority to unite the people in the holy bonds of matrimony."
Joseph would perform five more illegal marriages over the next two months, calling one the "ancient order of marriage."
[Brooke, John L. The Refiner's Fire: The Making of Mormon Cosmology, 1644-1844. Cambridge: Cambridge UP, 1994. p.212]