BEIJING — Newly married in San Francisco, two men with matching red ties held hands and smiled broadly as they bounded out of City Hall on a recent sunny day.
Though a common enough scene in the Bay Area, the marriage ceremony for this couple was notable for many Chinese people seeing the news: One of the men was Hanscom Smith, the United States consul general in Shanghai. Photographs of his marriage, posted Tuesday on the official Chinese microblog account of the United States consul general, generated interest in China, which does not allow same-sex marriage.
Mr. Smith married Lu Yingzong, or Eric Lu, who is from Taipei, Taiwan, an island that is independently governed but that the Chinese Communist Party claims it rules.
One Chinese Internet user by the name of Daniel Chen Dandan posted an image of a beating heart on a microblog, writing, “Respect any type of love.”
A few official Chinese news media websites picked up the photographs of the wedding and posted a short accompanying announcement. One photograph showed the men exchanging rings in front of a judge at City Hall.
The reports of the marriage were pointed reminders for some that China prohibits same-sex marriage. A gay couple in Hunan Province filed a lawsuit last year for the right to be married, and a court surprisinglyaccepted the case in January, but a judge ruled against the couple last month.
One of the men, Sun Wenlin, was told in a telephone interview on Tuesday that Mr. Smith and Mr. Lu had married in San Francisco.
“I support them very much,” he said. “My best wishes to them.”
He added that he hoped the visibility of the marriage would push Chinese officials to allow same-sex marriage in the future.
Despite the court ruling, Mr. Sun said he had made plans with his partner, Hu Mingliang, to hold a marriage ceremony in a park on May 17, the International Day Against Homophobia. He recently helped start a crowdfunding campaign to raise money for 100 gay couples across China to hold public marriage ceremonies.
Mr. Smith, the American diplomat, has served in embassy posts across the world, including in Afghanistan, Cambodia and Thailand, as well as in the American Institute in Taiwan, the de facto embassy for the United States on that island.
In an interview posted on a website of the American Chamber of Commerce in Shanghai, Mr. Smith said it was important for American officials like him “to engage with the Chinese audience directly through social media.”
In September 2014, the British consul general in Shanghai, Brian Davidson, married his Chinese-American partner, Scott Chang, at the British ambassador’s residence in Beijing. The wedding caused a stir on Chinese social media networks.
Mr. Smith, who arrived in Shanghai that month, was asked by the state-run newspaper Global Times what he thought about Mr. Davidson’s wedding.
“I have not yet had the chance to meet my British counterpart,” Mr. Smith said. “But I congratulate him on his wedding.”