WASHINGTON -- U.S. President Donald Trump's tweets declaring transgender people unwelcome in the armed forces have plunged the Pentagon into a legal and moral quagmire, sparking a flurry of meetings to devise a new policy that could lead to hundreds of service members being discharged.

Months after officially allowing transgender troops to serve openly in the military, the department may be forced to throw out those who willingly came forward after being promised they'd be protected.

A team of military lawyers has been pulled together to deal with the matter, Adm. Paul Zukunft, the Coast Guard commandant, said at the Center For Strategic and International Studies this week. These lawyers are working with the White House to flesh out some of the issues, and they're bolstered by a Pentagon working group that had initially been set up to advance the implementation of the Obama administration's year-old repeal of a transgender ban.

Now, they must deal with whatever new post-tweet policy emerges, according to the officials, who weren't authorized to speak publicly on the matter and requested anonymity.

Pentagon chief spokeswoman Dana White confirmed that talks between the White House and the Pentagon to work out the details of a new transgender policy have begun. Although it's unclear what the result will be, the discussions illustrate that Trump's aides aren't writing off his three-tweet salvo last week as an isolated outburst but as guidance for an upheaval in one of the military's most sensitive equal rights questions.

Whatever the final policy, court challenges are likely. And the personnel, health care and fairness issues sure to ensue may compel some soldiers, sailors and others to hide their identities and live a lie to remain in the military.

It's a scenario that raises the spectre of the now-defunct "don't ask, don't tell" policy that once governed gays in the military. While the 1993 compromise banned gay men and women from serving, it essentially safeguarded their places in the ranks as long as they kept their homosexuality hidden. More than 13,000 were discharged after the policy was enacted. While many others remained, they were forced to keep their sexuality in the closet.

Now, asks Sarah Warbelow, legal director for the Human Rights Campaign, "Are they going to go on a witch hunt?"

The Pentagon working group had been studying health care questions and how and when transgender people might be allowed to enlist. Now its members and the military's legal experts must contemplate forcing out transgender troops, including many who have served multiple combat tours.

If Trump stands by his tweet and the Pentagon is told to beginning discharging transgender service members, officials must address several questions: Who would be thrown out? What type of discharge would they receive? How long of a grace period would they have before leaving?

There also is no uniform method of tracking transgender troops across the services. That raises another challenge. Will the Pentagon target service members who have already asked to have their sex changed in the personnel system? Or would the crackdown expand to anyone who simply sought counselling on the issue?

Warbelow questioned where the effort would end. People could be scrutinized for how they look or dress. For example, she suggested, could female troops be suspect for wearing clothing considered "too masculine?"

Trump's tweets last week were direct. He said the government won't accept or allow transgender individuals to serve "in any capacity" in the military. "Our military must be focused on decisive and overwhelming victory and cannot be burdened with the tremendous medical costs and disruption that transgender in the military would entail," he wrote.

Estimates of the number of transgender troops in the service vary widely. A Rand Corp. study said roughly 2,500 transgender personnel may be serving in the active duty military, and 1,500 in the reserves. It estimated only 30 to 130 active duty troops out of a force of 1.3 million would seek transition-related health care each year. Costs could be $2.4 million to $8.4 million, it estimated.

The study found 18 other countries allow transgender people to serve openly in the military. "In no case was there any evidence of an effect on the operational effectiveness, operational readiness, or cohesion of the force," Rand said.

After Trump's tweets, Zukunft the commandant said, "the first thing we did is we reached out to all 13 members of the Coast Guard who have come out." But any reassurance Pentagon officials offered may prove hollow under a new policy.

Since last year, transgender service members have been able to serve openly in the military, receive medical care and start formally changing their gender identifications in the Pentagon's personnel system. About five weeks ago, Defence Secretary Jim Mattis gave military chiefs more time to determine if allowing transgender people to enlist would affect force readiness or effectiveness.

Trump's pronouncement triggered bipartisan denunciations. Military and other officials described it as the latest example of Trump's administration struggling to translate the commander-in-chief's Twitter proclamations into actual policy. Until the Pentagon gets a new policy directive in writing, Gen. Joseph Dunford, the Joint Chiefs of Staff chairman, and other military leaders have said nothing will change.