Nine Democratic presidential candidates touted their support for LGBTQ rights and sought to illustrate a stark contrast between their views and those of the man they hope to defeat in 2020: President Donald Trump.

A town hall Thursday hosted by the Human Rights Campaign Foundation and CNN focused on lesbian, gay, bisexual, transgender and queer rights. The candidates' views and policy proposals displayed more similarities — including ending the transgender military ban and passing the Equality Act — than differences.

Each was given about 30 minutes to address issues ranging from HIV prevention pills to hate crimes and violence. While the topics were wide-ranging, five themes could be found throughout the forum: violence, workplace discrimination, religion as a defense for discrimination, the HIV epidemic and LGBTQ youth.

The forum included nearly every top Democratic contender: South Bend, Indiana, Mayor Pete Buttigieg; former Vice President Joe Biden; U.S. Senators Elizabeth Warren, Kamala Harris, Cory Booker and Amy Klobuchar; former U.S. Representative Beto O’Rourke; former U.S. Secretary of Housing and Urban Development Julian Castro; and businessman Tom Steyer.

Bernie Sanders, who had been scheduled to attend, missed the event as he recovers from a heart attack.

Thursday's town hall in Los Angeles was the second Democratic presidential forum dedicated to LGBTQ issues this year. Last month, an event in Iowa drew 10 candidates.

Ahead of the forum, at least three candidates — Warren, Buttigieg and Harris — released detailed plans to secure equality for LGBTQ people, and their priorities for doing so include a number of similar initiatives.

At the event, Booker called hate violence against LGBTQ people of color “a national emergency” and said he plans to create a “presidential-level effort” against hate crimes and white supremacy.

“We can't stop there," he continued. "Thirty percent of LGBTQ youth — 30 percent — have reported missing school in the last month because of fears of their physical safety.”

Booker also promised to appoint a LGBTQ-friendly secretary of education. Warren also made a similar vow.

Many candidates also decried the violence faced by members of the transgender community.

“You’re right,” Harris said after she was interrupted by an activist who shouted that trans people were being “hunted.”

“There has to be serious accountability,” the senator said before highlighting efforts she made as San Francisco's district attorney to create a plan that prosecutors could use to beat the gay and trans panic defense.

Biden — whose first question came from Judy Shepard, mother of Matthew Shepard, the Wyoming man who was killed in a brutal 1999 hate crime — called for increased law enforcement efforts "to keep watch on these groups that we know are out there, like terrorist groups."

The former vice president also urged the passing of the Equality Act and predicted “very little disagreement” from his fellow candidates on the issue. Indeed he was right: Every candidate endorsed the Equality Act.

Buttigieg noted that the U.S. Supreme Court this week heard three cases regarding whether the Civil Rights Act protects LGBTQ people against discrimination at work.

"Let's remember that even if the Supreme Court upholds the idea that the Civil Rights Act applies to discrimination against, for example, same-sex couples in the workplace, we've still got a long way to go when it comes to other forms of discrimination, for housing, public accommodation," Buttigieg said. "That is why we urgently need an Equality Act. I will fight for that, and I will sign it the moment that it hits my desk."

Buttigieg, the only openly LGBTQ candidate, drew upon his religious background and said his marriage to Chasten Buttigieg moved him “closer to God." He also said that LGBTQ people, by dint of being randomly scattered throughout the population, can serve a healing role in society.

"We are in every state, every community, whether folks realize it or not, we are in every family, and that means also we can have the power to build bridges.”

In a viral moment that Warren's campaign quickly shared in a tweet, Warren was asked what she would say to a potential voter who tells her that his religion makes him believe that marriage is between one man and one woman.

“I’m gonna say: then just marry one woman. I’m cool with that — assuming you can find one," Warren joked.

How would I respond to someone who says marriage is between one man and one woman? #EqualityTownHall pic.twitter.com/8uNXqXI5n7 — Elizabeth Warren (@ewarren) October 11, 2019

Several candidates fielded questions about anti-LGBTQ countries. Biden swore to curtain foreign aid to anti-gay countries, and said Saudi Arabia, which executes gays, has “very little socially redeeming values,” eliciting murmurs from the crowd. “Culture is never a rationale for pain, never a rationale for prejudice,” Biden continued.

Candidates are also united in their mission to improve the HIV epidemic by expanding access to PrEP, pre-exposure prophylaxis, — and aside from lowering the price, some candidates called for more drastic measures.

O'Rourke endorsed an activist effort to #BreakThePatent and strip Gilead of its right to exclusively market and distribute Truvada in the U.S. market — though that privilege ends in September 2020.

Warren touted her plan to publicly manufacture PrEP. “I commit that in my administration, we will let out a government contract to produce that drug and make that drug available at cost, both here in the United States and around the world,” Warren said, avoiding saying the name of the patented drug, Truvada, that will go off patent next year.

Buttigieg, who came out publicly at age 33, was asked about pressure to be an "adequate representative" of the LGBTQ community.

“I so admire people who are coming out at young ages, but also recognize that there is no right age or time to come out," Buttigieg said. He noted he was well into his 20s before he could admit to himself that he was gay and said that going to war in Afghanistan made him realize he might die without ever “having any idea of what it's like to be in love.”

Gavin Grimm, a transgender activist and college student, asked Booker about Title IX of the Civil Rights Act, which forbids sex discrimination in education. “As your president,” Booker said, "I will fight for it with the same ferocity the same sense of urgency every single day for LGBTQ Americans.”

Jacob, a young trans boy from Massachusetts, asked Warren about school safety for LGBTQ children. "Here's what I plan to do," Warren told Jacob. "I'm going to make sure that the person I think is the best Secretary of Education meets you and hears your story, and then I want you to tell me if you think that's the right person, and then we will make the deal.”

The event was historic in many ways. It represents the longest extended discussion devoted to LGBTQ rights with major presidential candidates and featured multiple gay moderators. The four-hour event faced several interruptions, including three by transgender activists, including an extended exchange between Blossom Brown, Don Lemon, and Beto O'Rourke.

And Democrats are fighting for LGBTQ vote in primaries and the general election. LGBT people made up 6 percent of the electorate in the 2018 midterms, and 82 percent cast their ballot for their district’s Democratic candidate for the House of Representatives, according to a NBC News exit poll.

Research from UCLA's Williams Institute shows that 9 million LGBTQ Americans are now registered to vote and half are Democrats, 15 percent are Republicans and 22 percent are independents. They're likelier to support a minority candidate, but also are likelier to "say that they would support a seasoned political candidate," according to the research. The Human Rights Campaign estimates that 57 million voters prioritize LGBTQ-inclusive policies when picking candidates.

Follow NBC Out on Twitter, Facebook & Instagram