The White House's Friday guidance to stop accepting transgender people into the military and to potentially oust those already serving will be difficult to implement fully, according to legal experts.

There's never been a case for removing a class of people from the military who have already been serving based on race, gender or sexual orientation, said Jennifer Levi, a lead attorney for five transgender troops suing President Trump and the Pentagon over the ban.

"From a legal standpoint, the military can't create special rules that limit people's service or that treats them in ways that limit their opportunities just because of who they are," said Levi, a transgender rights project director with GLBTQ Legal Advocates and Defenders.

Trump's newly signed presidential memo instructs the Pentagon to stop accepting transgender people who want to enlist in the military, stop payments for gender reassignment medical treatment and further explore how to handle transgender people currently serving in the armed forces. The rules would be implemented fully by March 23, 2018.

The executive memo follows a series of tweets sent by Trump on July 26 declaring that transgender troops would no longer serve "in any capacity" in the U.S. military.

Trump tweeted that the military "cannot be burdened with the tremendous medical costs and disruption" brought by transgender service members, noting that he had consulted with his "generals and military experts." It was later reported that Defense Secretary James Mattis was given one day's notice of the decision.

The guidance also gives Mattis the authority to determine if transgender troops already in the ranks can continue to serve.

Mattis now has six months to work out details of the new rules.

Todd Weiler, a former assistant secretary of Defense under former President Barack Obama, said it will be easier for Trump to implement a policy to restrict transgender people from enlisting than it will be removing transgender people already serving.

"Implementation for future restriction may be easier because we have a history of not accepting people for a variety of reasons," Weiler told The Hill. "We already create different standards for people to enter the military."

It's far more difficult, however, to retroactively dismiss people already in service.

"Folks that are already in, they've already met the standards," said Weiler, who helped craft the current policy to allow transgender people to serve openly in the military, which was implemented last year.

"The way that we wrote the policy, before you come in you have to be stable in your new gender for 18 months. The reality is, there is no impact whatsoever to readiness or to unit cohesion or anything of that nature. We studied this," Weiler said.

Carl Tobias, a legal expert at the University of Richmond's School of Law, said while those opposing the ban can legally "make the argument there's discrimination," the case will be difficult to win as it involves the military.

"The courts have often been reluctant to interfere or to resolve those kinds of cases in ways favorable to the plaintiffs challenging them," Tobias told The Hill.

"I think there's an argument for discrimination, and yet there's all these special rules about the military and the president's power as commander in chief," he said.

Tobias did note that Trump's directive seems to give Mattis leeway to allow transgender service members to stay in the ranks.

"I think the president grants Mattis pretty much the discretion to make that determination," Tobias said. "Depending on what Mattis thinks and how he goes about it, it could be that he says everybody's in or everybody's out rather than take it case by case."

But the transgender ban policy already faces intense opposition from top Republican senators, dozens of retired generals and admirals and advocacy groups.

Senate Armed Services Chairman John McCain (R-Ariz.) called the guidance "a step in the wrong direction" to oust currently serving transgender individuals "solely on the basis of their gender identity rather than medical and readiness standards that should always be at the heart of Department of Defense personnel policy."

Congress could try to interfere by passing a statute that purports to overrule the executive memo, Tobias said.

The ban is also already the subject of a lawsuit.

GLAD and the National Center for Lesbian Rights jointly filed suit Aug. 9 for five transgender troops contesting the ban. The groups also plan to file a motion in D.C. district court.

The motion, while working its way through the courts, could stop the Pentagon from moving forward on the new policy.

Levi told The Hill it "would ensure that there would be no harm to the transgender service members who are currently in the military and would prohibit the administration from excluding transgender people from serving."

Even top members of the military oppose Trump's move to ban transgender troops, including Navy Secretary Richard V. Spencer and Coast Guard Commandant Adm. Paul Zukunft.

"It's really unprecedented for the White House to override such a considered and studied judgment on the part of military leaders about personnel," said Shannon Minter, NCLR legal director and the lead attorney on the case with GLAD. "I think they will have a hugely uphill battle."