The American public leans in favor of allowing transgender people to serve in the U.S. military, new polling finds.

Half say that trans people should be allowed to serve in the U.S. military, while just 31 percent think they should be barred from doing so, according to a HuffPost/YouGov survey released Friday. For comparison, 59 percent think openly gay and lesbian troops should be allowed to serve. (A Reuters/Ipsos poll, also released Friday, found higher support for trans service members, with 58 percent of the public in favor.)

On Twitter Wednesday, President Donald Trump said that transgender people would no longer be allowed to serve in the military “in any capacity,” citing what he called “tremendous medical costs and disruption.”

“It’s just a shot in the face,” Kasia Celeste, a U.S. Navy sailor who is trans, told HuffPost about Trump’s announcement. “A lot of us are scared and angry because we all signed up to do the same job. Who has the right to say you can’t fight for your country?”

Twelve percent of Americans think that allowing trans people to serve strengthens the military, the HuffPost/YouGov poll finds, while 25 percent say it makes the military weaker, and 50 percent say it doesn’t affect the strength of the military either way.

The 3 in 10 Americans who know at least one transgender person ― or who are trans themselves ― are more likely to be supportive of their inclusion in the military. Sixty-two percent of those who know a trans person think trans military members should be allowed to serve, compared to 45 percent of those who don’t know anyone who is trans.

There’s also a substantial divide along age and political lines. Seventy-two percent of those who supported Trump in last year’s election, but just 5 percent of those who backed Hillary Clinton, think trans people should be barred from serving. About 40 percent of Americans age 45 or older, but just 17 percent of those under age 30, think trans troops should be prevented from serving.

A majority of the public, 52 percent, say that trans people currently face a lot of discrimination in the U.S.

Use the widget below to further explore the results of the HuffPost/YouGov survey, using the menu at the top to select survey questions and the buttons at the bottom to filter the data by subgroups:

The HuffPost/YouGov poll consisted of 1,000 completed interviews conducted July 27-28 among U.S. adults, using a sample selected from YouGov’s opt-in online panel to match the demographics and other characteristics of the adult U.S. population.

HuffPost has teamed up with YouGov to conduct daily opinion polls. You can learn more about this project and take part in YouGov’s nationally representative opinion polling. More details on the polls’ methodology are available here.

Most surveys report a margin of error that represents some, but not all, potential survey errors. YouGov’s reports include a model-based margin of error, which rests on a specific set of statistical assumptions about the selected sample rather than the standard methodology for random probability sampling. If these assumptions are wrong, the model-based margin of error may also be inaccurate. Click here for a more detailed explanation of the model-based margin of error.