KANSAS CITY, Kan. — Sharice Davids, a leading Democrat in a key congressional primary election on Tuesday, finished a White House fellowship in the early months of the Trump administration. As a lesbian and a Native American, she became convinced that hard-won progress on issues like gay rights and the environment would erode under Mr. Trump, and thought Kansans in her district might support her as a counterforce to the president.
”We had to focus on getting more people elected to decision-making positions because that’s the way that we offset someone who wants to destroy the E.P.A. being appointed to run the E.P.A,” she said, referring to Scott Pruitt, Mr. Trump’s now-departed agency administrator.
Ms. Davids is among more than 400 gay, lesbian, bisexual or transgender candidates running for office this year — a record number, according to groups that track such data. Most are Democrats, and several are mounting anti-Trump congressional bids with a message broader than gay rights. Ms. Davids says she talks mostly about issues like health care and only had one exchange with a voter who questioned whether a gay person could win.
Around half of these candidates are running for state offices, a priority for activists who say many of the most important civil rights battles are happening close to home. In 2017, more than 120 bills described as “anti-L.G.B.T.” were introduced across 30 states, including adoption laws and so-called bathroom bills, according to the Human Rights Campaign. By January, 12 of them had become law.
“We have seen a clear correlation between the presence of our legislators and passage of that legislation,” said Annise Parker, the former mayor of Houston and the chief executive of the L.G.B.T.Q. Victory Institute, a bipartisan group that tracks and supports gay and transgender candidates.
Ms. Davids and other candidates are also pursuing a new kind of political strategy that treats sexuality, race and gender as campaign assets that intersect with their criticism of Mr. Trump, their warnings about lost progress on civil rights, and their policy ideas.
Like many racial minority or female candidates this year, many L.G.B.T. candidates are aiming to appeal to broader audiences than campaigns of the past, when gay candidates often ran in predominantly gay areas and tailored their pitches to those communities. Today, L.G.B.T. candidates might tout a law enforcement background to appeal to the political center or campaign with their spouses and children to underscore an interest in policy issues important to parents.
Read more about racial minority candidates and women running for office
“I am sure there are going to be older people who are concerned about my being out or being a woman or being a pro-choice candidate or something,” said Ms. Davids, who is running in a six-way primary in the Third Congressional District, which covers Kansas City and its environs, including one of only two counties in Kansas that voted for Hillary Clinton. “But I wouldn’t be running if I thought that number was so high that it was unrealistic to be electable.”
Many of the candidates are running in states far from liberal areas on the East and West Coasts. They include Senator Tammy Baldwin of Wisconsin, who is seeking re-election; Representative Jared Polis, who is the Democratic nominee for governor of Colorado; and Representative Kyrsten Sinema, who is running in the Aug. 28 Senate primary in Arizona.
There are also many first-time candidates like Ms. Davids in Kansas; Christine Hallquist, a transgender woman running in the Aug. 14 Democratic primary to be governor of Vermont; and Rick Neal, a former humanitarian aid worker in Afghanistan and Liberia and current stay-at-home dad in Columbus, Ohio.
Mr. Neal won the Democratic primary in the 15th District of Ohio and will compete in November against Representative Steve Stivers, the chairman of the National Republican Congressional Committee. Mr. Neal said some voters were “naturally curious” about how he would appeal to people who “may not be comfortable” with his sexuality.
“I just talk about what I want to work on and what I want to do for people,” he said, citing issues like campaign finance reform and improving access to health care.
Mr. Neal said his campaign had gone smoothly, except for the day someone put a sticker for a white supremacist group on a lawn sign in front of his home. He has two African-American daughters, ages six and nine, and called the incident “pretty unsettling.”
“I guess at the end of the day a gay guy with an interracial family running for Congress is a little bit like waving a red flag in front of a bull for some folks,” he said. “I felt like they were trying to intimidate us and that’s just not going to work.”
The rising number of L.G.B.T. candidates comes at a time when the Trump administration has moved to roll back protections for gay and transgender people. Its actions have included an attempt to ban transgender people from serving in the military and a Justice Department decision to argue that the 1964 Civil Rights Act does not protect gay workers.
A shift to the right is also looming on the Supreme Court with the nomination of Judge Brett Kavanaugh, a conservative jurist, to replace the retiring Justice Anthony Kennedy, who wrote many of the landmark gay rights cases decided by the court in recent years.
There are roughly 500 openly L.G.B.T. elected officials in the country, including one governor and seven members of Congress, the Victory Institute said in a recent report. That is 0.1 percent of elected officials.
“If you’re not at the table, you’re on the menu,” said Jessica Gonzalez, who is running unopposed for a seat in the Texas House of Representatives to represent the 104th District, in Dallas County. She said L.G.B.T. lawmakers could “definitely make a big difference.”
Ms. Davids, of Kansas, agreed. “Having L.G.B.T. people sitting in the room while decisions are being made, and sitting there as peers, will shift the conversation,” she said. “I think it’s important that the lived experiences and the point of view of L.G.B.T. folks be included in conversations that affect all of us.”
Despite the growing number of candidates, Andrew Reynolds, a professor of political science at the University of North Carolina at Chapel Hill who tracks those numbers, said he was “not convinced there will be a dramatic increase in the number of statehouse members.”
“It’s not like a massive rainbow wave that will dominate news stories,” he said.
There are 13 states — largely in the Midwest and the South — where no gay or transgender people serving in the legislature. The experience of candidates there point to the challenges that remain.
Michael Aycox, 30, who ran in a Democratic primary this spring in a Mississippi district that President Trump won by 24 points, was the first openly gay congressional candidate in the state’s history. He lost by almost 40 points.
Mr. Aycox, a police officer whose campaign proposed greater federal support of veterans, said he faced opposition from other Democrats who told him it was too early for Mississippi to elect a gay congressman.
“I had 17 death threats,” Mr. Aycox said. “My community respects me, but they’re going to stand with their religious beliefs every day. Religious beliefs are the governing framework for this state.”
While most of the candidates are Democrats, Peter Boykin, 40, the founder of Gays for Trump, is running for North Carolina’s Legislature as a Republican focused on issues like education. He said the party had “totally embraced” him.
“The L.G.B.T.Q. community have been brainwashed that the Democratic Party is for their best interests, and it’s not the case,” Mr. Boykin said, pointing out that Barack Obama and Hillary Clinton initially opposed gay marriage.
Mr. Boykin acknowledged that the Republican Party has “some issues” with respect to gay rights, but he said working with “these so-called homophobic senators” is more effective than taking a combative stance.
That is why some, like Ms. Davids, said they were running for office in the first place: to get different kinds of people engaged with the political process.
“We are going to elect more women this year, we’re going to elect more people who are L.G.B.T., we’re going to elect more people who are people of color,” said Ms. Davids, a member of the Ho-Chunk Nation, a Native American tribe in Wisconsin. “This midterm election cycle is our opportunity to demonstrate who we are as a country.”
Liam Stack reported from Kansas City, Kan., and Catie Edmondson from Washington.
Read about Tuesday’s voting
Voters in Kansas, Michigan, Missouri, Ohio and Washington State are heading to the polls on Aug. 7.