This month’s midterm elections resulted in the election of more openly lesbian, gay, bisexual and transgender people than ever before. But for Cross Coburn, who served as an openly gay councilman in a small Texas city, it was a day of bitter defeat.

He was ousted in a recall election on Nov. 6, nine months after he was told that City Hall had received an anonymous package of nude photos that Mr. Coburn had sent in private messages on the dating app Grindr. Those photos were later sent to the local news media, after which supporters of a petition to remove him questioned whether he fit the “moral standards” of the city.

“I regret that it got out, but I will never regret being human,” said Mr. Coburn, who served about one year of a two-year term. “I do not believe that me having consensual conversations with another adult has any merit to how I can perform my duties.”

Mr. Coburn, 19, ran uncontested for the nonpartisan position last year and supported progressive policies in Groves, Tex., a conservative community of about 16,000 people near the Louisiana border.

“I did want to give back to this place that raised me,” Mr. Coburn said.

He said he had encountered sexual bias while growing up in Groves and was regularly bullied by other children. As the petition and recall campaign against him built, Mr. Coburn said, he thought he was being targeted by religious conservatives because of his sexuality.

Chuck Smith, the chief executive of Equality Texas, an advocacy group focusing on L.G.B.T. issues, said the recall result was “sad,” especially in contrast to the success of L.G.B.T. candidates nationwide.

“Someone organized the equivalent of a tar-and-feathering to get him removed from office,” Mr. Smith said.

Sex scandals, particularly those involving explicit photographs, have long led to the downfall of politicians. Eric Greitens, the former governor of Missouri, resigned earlier this year after he was accused of taking an explicit photograph of a woman he was having an affair with without her permission, and threatening to make the photograph public if she told anyone about him.

Last year, Representative Joe Barton, Republican of Texas, announced that he would not run for re-election this year after a sexually explicit photograph of himself was posted by an anonymous Twitter account. At the time, Mr. Barton suggested that he was a potential victim of a crime under the state’s so-called revenge pornography law.

Mr. Coburn is now formally challenging the outcome of his recall election, filing a complaint in the District Court of Jefferson County that alleges, in part, that some signatures on the petition were forged. He has also asked the state attorney general to look into that allegation; a spokeswoman for the office said she could neither confirm nor deny an investigation.

He said he believed that he had been blackmailed through the dating app, and that Mayor Brad Bailey and Councilman Kyle Hollier helped orchestrate the recall effort.

Mr. Coburn lost a recall election, but the council did not appoint a new member on Thursday.

Mr. Bailey did not respond to requests for comment about Mr. Coburn. “I think you should be held to a higher position up here and his track record speaks for itself,” he told reporters in September, according to Texas Monthly.

Reached by email, Mr. Hollier said his “only comment” was “the voters of Groves have spoken.”

Mr. Coburn was elected to the City Council in 2017 after the incumbent councilman unexpectedly withdrew from the race, saying that a contested election would be too costly for the city, according to The Port Arthur News.

Nothing seemed amiss during his first few months in office, he said, but in February he was summoned to a meeting with Mr. Bailey because of a “personal matter.”

“At that point I was confused,” Mr. Coburn said. “I was a little shocked. I didn’t know what he meant.”

At the meeting, Mr. Coburn said, Mr. Bailey produced a manila envelope that he said had been anonymously mailed to City Hall. It contained screenshots of a conversation Mr. Coburn had with another man on Grindr, along with nude photos of Mr. Coburn.

Mr. Coburn said that he does not know who received the photos he had sent on Grindr, and that any identifying information on the screenshots received by the city had been edited out.

According to Mr. Coburn, Mr. Bailey indicated that he could choose to resign, or that the city could initiate an unspecified investigation. Days later, the mayor directly asked Mr. Coburn if he would resign.

He said no.

Soon Mr. Coburn started getting calls from the local news media. Someone had sent them the photos. Mr. Coburn found himself on the defensive, and he apologized.

“At this point I don’t know what I apologized for,” Mr. Coburn said. “It was on a private dating app. I really don’t have anything to apologize for. But I was apologizing that it was brought up in the first place.”

According to Texas Monthly, the photos were sent to the news media shortly after the city attorney had suggested in an internal email that only citizens could remove Mr. Coburn, via a recall election. A resident soon started the petition, which received more than 900 signatures.

In the recall election on Nov. 6, just over 2,400 Groves residents voted in favor of removing Mr. Coburn, about 62 percent of the total votes cast. Mr. Bailey was narrowly re-elected in his race.

On Friday, Mr. Coburn said the fight was far from over, pointing in part to his complaint, but also to what he called a renewed political vigor from the experience.

“It has given me a sense of duty,” he said.