The leader of the Church of Jesus Christ of Latter-day Saints has reaffirmed the religion’s opposition to same-sex marriage, saying God’s law dictates that marriage is restricted to unions between a man and a woman.

The church president, Russell M Nelson also said during a speech to students at the church-owned Brigham Young University that the religion’s love for everyone regardless of sexual orientation led to the repeal earlier this year of a 2015 policy that banned baptisms for children of parents in same-sex relationships and labeled gay couples as sinners eligible for expulsion.

Nelson said love also motivated the original policy as he and other leaders attempted to prevent friction between the beliefs of gay parents and their children. Nelson became president last year but was a member of a top governing body called the Quorum of the Twelve Apostles when the policy took effect.

“We knew that this policy created concern and confusion for some and heartache for others,” said Nelson, who is considered a prophet by church members. “That grieved us. Whenever the sons and daughters of God weep, for whatever reasons, we weep.”

Nelson contended that leaders can’t change God’s laws but have the authority to adjust church policy.

The remarks were the latest move in a continuing effort by the Utah-based faith widely known as the Mormon church to carve out a compassionate stance toward LGBTQ people while adhering to opposition of gay marriage.

Critics say the balancing act has led to a confusing push-and-pull of policies that leave LGBTQ members and their allies confused and sometimes distraught. The 2015 policy angered many and led to protests and some defections.

The church considers homosexual relations a sin, forcing gay and lesbian members to avoid intimate relationships to remain full-fledged members.

Nelson, 95, said in a basketball arena packed with nearly 19,000 students that they must follow God’s laws if they want exaltation.

“The arbiter of truth is God, not your favorite social media news feed, not Google, and certainly not those who are disaffected from the church,” Nelson said.