Pete Buttigieg is drawing criticism after pictures of him volunteering for the Salvation Army, which has historically opposed gay rights, recently resurfaced on social media.

In the photos, Buttigieg is seen standing outside Peggs restaurant in South Bend, Indiana, where he is the mayor, for the Red Kettle Ring Off, an annual charity initiative during which public officials compete to raise money for the Salvation Army. While the photos were from 2017, Buttigieg, who has surged to the top of many polls of Democratic presidential candidates in Iowa, has been participating in the event since at least 2015, according to local news reports. He also held an event at the Salvation Army in South Bend last year.

“I know the photos are two years old, but still, I can't help but wonder if Mayor Pete just looks at what LGBTQ activists have been working on for years and then chooses to spite it,” tweeted Zach Ford, press secretary of the Alliance for Justice, a progressive judicial advocacy organization.

I know the photos are two years old, but still, I can't help but wonder if Mayor Pete just looks at what LGBTQ activists have been working on for years and then chooses to spite it (e.g. Salvation Army, Chick-fil-A, queer media in general, etc.). https://t.co/zSYzlRLrOX — Zack Ford (@ZackFord) December 4, 2019

The Salvation Army, which was founded in England in 1852 with the stated mission “to preach the gospel of Jesus Christ and to meet human needs in His name without discrimination,” has a documented history of discrimination against LGBTQ people. This troubled history includes refusing to comply with legislation and ordinances requiring the extension of benefits to same-sex spouses of employees and offering links to gay conversion therapy organizations on their website.

In 2012, a Salvation Army spokesperson implied that gay people should be put to death and several homeless trans women from across the country have reported discriminatory treatment from the charity, saying the organization denied them shelter. In 2017, the New York City Commission on Human Rights filed complaints against the organization for allegedly refusing transgender clients at a New York substance abuse center.

The Salvation Army did not immediately respond to NBC News’ request for comment.

The charity has attempted to leave its controversial past behind in recent years. On its U.K. website, it states that the Salvation Army “stands against homophobia, which victimises people and can reinforce feelings of alienation, loneliness and despair.” The website adds that though individual members of the organization may hold different views about LGBTQ people, the organization as a whole condemns discrimination on the basis of sexual and gender identity. The U.S. page of the Salvation Army’s website includes anecdotes from LGBTQ people that have been helped by the charity.

Critics online, however, are not fully convinced that the organization can be divorced from its past and criticized Buttigieg for associating with it, as Out magazine first reported.

“Apparently race issues aren't the only thing @PeteButtigieg is slow to grasp,” one tweet read, referring to past comments Buttigieg made about the lack of educational role models in low-income, minority neighborhoods. “What is his excuse for not realizing the Salvation Army is homophobic?”

Buttigieg addressed the criticism at a town hall in Henniker, New Hampshire on Thursday.

"We were raising money to help poor people, and there's a lot of questions and disagreements that I have with any number of organizations that I will also partner with in order to do something good," Buttigieg said. "That's the case with the Salvation Army red kettle ring off that I participated in as mayor."

Many of his supporters also defended him against the criticism online.

“We in the #LGBTQ & others are nuanced,” wrote one user. “The act of service to others doesn’t mean the absolution of another’s hate to others.”

“Whoa… I don’t know if Mayor Pete can recover from this oppo hit which shows him [checks notes] collecting money for the poor,” wrote American political and communications consultant Frank Luntz.

This is not the first time Buttigieg has been censured for his alliance with an organization that has a controversial track record on LGBTQ rights.

Earlier this year, Buttigieg was criticized for comments he made about brokering a “peace deal” between the LGBTQ community and Chick-fil-A, which has a history of donating to anti-LGBTQ companies. Last month, Chick-fil-A announced it would stop donating to organizations that do not support gay rights after years of protests and criticism.

Buttigieg’s comments about not following LGBTQ media during a September interview with Sirius XM’s Clay Cane also drew criticism, with many queer journalists questioning why a openly gay candidate would disavow LGBTQ media.

Follow NBC Out on Twitter, Facebook & Instagram