The decision to invite Mr. Cox to speak at the vigil was not without controversy, said Troy Williams, the executive director of Equality Utah, which organized the gathering. The L.G.B.T. community in Utah has had a largely adversarial relationship with the current administration, which has joined a lawsuit against the Obama administration over the use of bathrooms by transgender people and opposes same-sex marriage.

Mr. Williams said he did not know what Mr. Cox would say when the politician was invited to speak, but said the lieutenant governor had long been open to discussion. He called the result “a beautiful speech.”

“We hope that this will set a new standard of discourse with Republican leadership,” he said.

Mr. Cox said he had mended his relationship with those students he teased in high school. One of them reached out to him after the speech and thanked him, he said.

He said his attitudes changed as he got to know people in the gay community, whom he praised for their patience with him. He said he would sometimes say the wrong things “because I’m not sure how to say the right things, but they laugh and kind of help me through it.”

“When you actually sit around and really get to know someone, it makes it much harder to demonize or discredit people,” he said. “We can have disagreements over policy and still love each other and still be friends, and that’s something I think is getting lost more and more in the partisan world we live in.”