Elton John and his longtime boyfriend, David Furnish, entered a civil partnership on Dec. 21, 2005, in England under a law the country had just enacted granting recognition to same-sex couples. The congratulations poured in as the two men appeared at a joyous ceremony at Windsor Guildhall, amid a crush of paparazzi. Donald J. Trump, who had known the couple for years, took to his blog to express his excitement.

“I know both of them, and they get along wonderfully. It’s a marriage that’s going to work,” Mr. Trump wrote, adding: “I’m very happy for them. If two people dig each other, they dig each other.”

Mr. Trump is now the leading candidate for president in the Republican primary, which has traditionally been dominated by hopefuls eager to show how deeply conservative they are on social issues like gay rights and marriage.

But Mr. Trump is far more accepting of sexual minorities than his party’s leaders have been. On Thursday, he startled some Republicans by saying on NBC’s “Today” show that he opposed a recently passed North Carolina law that prohibits people from using public bathrooms that do not correspond to the gender they were born with, striking down a Charlotte ordinance.