“To state the obvious,” Judge Waddoups wrote, “the intervening years have witnessed a significant strengthening of numerous provisions of the Bill of Rights.” They include, he wrote, enhancements of the right to privacy and a shift in the Supreme Court’s posture “that is less inclined to allow majoritarian coercion of unpopular or disliked minority groups,” especially when “religious prejudice,” racism or “some other constitutionally suspect motivation can be discovered behind such legislation.”

The challenge to the law was brought by Kody Brown, who, along with his four wives and 17 children, stars in “Sister Wives,” the reality television show. The family argued that the state’s prohibition on cohabitation violated its rights to privacy and religious freedom. The Browns are members of the Apostolic United Brethren Church, a fundamentalist offshoot of the Mormon Church, which gave up polygamy around 1890 as Utah was seeking statehood.

The judge cited the decision in Lawrence v. Texas, the 2003 Supreme Court case that struck down laws prohibiting sodomy. He quoted the majority opinion by Justice Anthony M. Kennedy that stated the Constitution protects people from “unwarranted government intrusions into a dwelling or other private places” and “an autonomy of self that includes freedom of thought, belief, expression and certain intimate conduct.”

In a statement, Mr. Brown said he and his family were “humbled and grateful for this historical ruling from the court today.” He noted that “many people do not approve of plural families,” but “we hope that in time all of our neighbors and fellow citizens will come to respect our own choices as part of this wonderful country of different faiths and beliefs.”

As same-sex marriage has gained popular approval and legal status in recent years, some have hoped — and some feared — that other forms of cohabitation might follow. Justice Antonin Scalia, in his bitter and famous dissent from the 2003 Lawrence case, said the nation was on the verge of the end of legislation based on morality, and was opening the door to legalizing “bigamy, same-sex marriage, adult incest, prostitution, masturbation, adultery, fornication, bestiality and obscenity.”