(Reuters) - Five transgender members of the U.S. military including Iraq and Afghanistan war veterans sued President Donald Trump on Wednesday, challenging his ban on transgender people serving in the armed forces.

Slideshow ( 2 images )

Trump said on Twitter on July 26 that the U.S. government “will not accept or allow transgender individuals to serve in any capacity” in the military, a reversal of Pentagon policy that the lawsuit said was made without consulting senior military commanders.

The surprise announcement, citing healthcare costs and unit disruption, appealed to some in Trump’s conservative political base but created uncertainty for thousands of transgender service members, many of whom came out after the Pentagon said in 2016 it would allow transgender people to serve openly.

Trump’s tweets appeared to dismiss findings from a RAND Corporation study commissioned by the Pentagon that found allowing transgender people to serve would “cost little and have no significant impact on unit readiness.”

The White House and the Pentagon said they do not comment on pending litigation. The lawsuit was filed in U.S. District Court in Washington, D.C.

The service members suing the president are three U.S. Army soldiers, one U.S. Air Force airman and one member of the U.S. Coast Guard who are active duty.

All have come out as transgender to their commanding officers but are anonymous in the lawsuit, named only as Jane Doe, for fear of retribution, said Jennifer Levi, a lawyer from GLBTQ Legal Advocates & Defenders. The group filed the lawsuit along with the National Center for Lesbian Rights.

The American Civil Liberties Union said it was preparing its own lawsuit.

The lawsuit said Trump’s tweets violate the rights of the service members to due process and equal protection under the law. It asks the court to declare Trump’s directive as unconstitutional and to issue injunctions to stop it.

The defendants are listed as Trump, Defense Secretary James Mattis and other military leaders including Joseph Dunford, the chairman of the Joint Chiefs of Staff. Dunford said in a memo a day after Trump’s tweets that there would be no change in policy until Mattis received an official order from the president.

That order has yet to be issued.

“In the meantime, we will continue to treat all of our personnel with respect,” Dunford said.

Lawyer Levi said the plaintiffs, some of whom are near retirement, need not wait for an official policy because the tweets alone created uncertainty about their futures.