Pete Buttigieg, a 2020 candidate for president and the mayor of South Bend, Indiana, is, unsurprisingly, facing homophobic protests on the campaign trail.

A man interrupted a recent Buttigieg rally in Iowa, for example, and shouted at the candidate: “Remember Sodom and Gomorrah.” The protester was quickly drowned out by Buttigieg’s supporters, and the mayor also indirectly addressed the comment to the crowd.

“The good news is the condition of my soul is in the hands of God, but the Iowa caucuses are up to you,” Buttigieg, a moderate Democrat, said.

At another Buttigieg event, costumed fringe religious demonstrators showed up dressed as Mayor Pete, Jesus, and Satan. Pete was whipping Jesus, who’s carrying the cross, while the devil shouts at them. The person dressed as the devil can be heard shouting: “Beat him Peter, beat him. I hate this guy,” as well as, “More blood, Peter. Every vote is a lash on the back of Christ.”

The protests are not shocking. LGBTQ candidates expect them and usually have strategies in place to deal with the events, as well as more subtle attacks on their identities, according to political strategists who work to get them elected.

“The purpose of anti-LGBTQ attacks on our candidates is to mobilize homophobic and transphobic voters and to distract the LGBTQ candidates from the messages that resonate with their constituents,” said Elliot Imse, communications director at the LGBTQ Victory Fund, a political action committee that helps elect queer candidates.

Imse said that the group advises candidates to not fixate on homophobic or transphobic attacks but on the issues that appeal to voters. But candidates can use hostile protests to their advantage to rally loyal supporters and donors.

“When an LGBTQ candidate comes under attack, we usually try to ensure that the mainstream media picks up on that attack, because that is an opportunity to mobilize,” Imse said.

The Victory Fund has worked with numerous candidates targeted by anti-gay and anti-trans attacks. Opponents of Malcolm Kenyatta, a Pennsylvania state representative whom Victory fundraised for and endorsed, distributed fliers during his campaign that showed him with an ex-boyfriend.

“Say no!!!!” the fliers said, in red capital letters.

Kenyatta refocused the attacks on his platform.

"There are big issues to address: poverty, schools, and housing," Kenyatta said last May. "People have no patience for the bigoted political games, and our resounding victory on Tuesday makes that clear."

Similarly, Danica Roem, a Virginia state representative and the first transgender woman elected to any U.S. state legislature, faced off against an opponent who distributed fliers that willfully misgendered her. “Danica Roem In His Own Words,” the flier said.

But sometimes attacks can be much more subtle and rely on dog whistles to attack gay and trans candidates, Imse said. Candidates may be smeared as “unelectable,” for example, or as being “too weak.” (This latter form of attack has already materialized against Buttigieg, with one prominent GOP political strategist, Patrick Ruffini, implying that Vladimir Putin would not be threatened by Buttigieg.)

“The veiled attacks are powerful,” Imse said. “Those attacks work.”

Tucker Carlson recently targeted Buttigieg in a monologue that some have characterized as a dog whistle-homophobia. Carlson said the news media had abandoned Beto O’Rourke for a “younger, hotter” candidate, Buttigieg, whom they want to eat "like a hearty stew ... yum!”

That said, American voters seem more willing than ever to support LGBTQ candidates. Sixty-eight percent of American voters said in a recent poll that they would be “OK” with a gay man as president, a stark shift from just 43 percent who said the same in 2006. It’s a sign that real progress has been made — with a wave of historic wins for LGBTQ candidates in just the last few years — even as they continue to face transphobic and homophobic opposition.