The Mormon Church once stood at the forefront of the fight against same-sex marriage with its support of a 2008 California ballot measure, known as Proposition 8, that limited marriage to a man and a woman. But that advocacy brought a backlash from outside the church as well as from its own members, and since then, the church has modulated its tone and positions on some gay rights issues.

This year, Mormon leaders supported a law passed by Utah’s Republican-dominated government that outlawed housing and employment discrimination against gay, lesbian, bisexual and transgender people. Called the “Utah compromise,” it exempted religious groups that object to homosexuality.

The Mormon Church itself joined other religious groups in filing briefs with the Supreme Court opposing same-sex marriage. After the court’s decision in June, the Mormon Church said it would not perform same-sex marriages. The changes in the law, it said, “do not, indeed cannot, change the moral law that God has established.”

But in his speech on Tuesday, to an audience of legal and clergy officials in Sacramento, Elder Oaks said that religious freedom should not be asserted “to override every law and government action that could possibly be interpreted to infringe on institutional or personal religious freedom.”

Elder Oaks is a former Utah Supreme Court justice who also worked as a United States Supreme Court clerk for Chief Justice Earl Warren. In January, he was among the Mormon leaders who appeared at a rare news conference at which they announced the church’s willingness to support the antidiscrimination legislation.

“Even where they have challenged laws or practices on constitutional grounds, once those laws or practices have been sustained by the highest available authority, believers should acknowledge their validity and submit to them,” Elder Oaks said.

Erika Munson of Mormons Building Bridges, which tries to improve relations between the church and gay people, said that court rulings striking down same-sex marriage bans had unsettled some Mormons in Utah. A federal judge’s ruling in December 2013 legalizing same-sex marriage across the state was the first jolt, and the Supreme Court decision in June was the last.

“I think Mormons in particular haven’t quite known what to do with the new reality of legal gay marriage,” Ms. Munson said. “We can now have much more open conversations about how we live our Mormon-ness. We have to learn to live with our neighbors. It’s done. It’s a done deal.”