The ACLU on Monday joined several other advocacy groups in filing a lawsuit to challenge President Trump’s new directive to ban transgender people from joining the military and review whether those already serving can stay.

The federal suit was filed in Maryland on behalf of several transgender people serving in the Army, Navy, Air Force and Marines, including Petty Officer 1st Class Brock Stone, a state resident and 11-year Navy veteran.

Trump on Friday formally directed the Pentagon to implement the ban on transgender individuals joining the military, which he first announced in a July 26 tweet. And he gave the Pentagon the authority to decide the future of openly transgender people already serving.

The 39-page ACLU suit, Stone v. Trump, is the third such court action in response to Trump’s decision.

On Aug. 9, GLBTQ Legal Advocates & Defenders, or GLAD, and the National Center for Lesbian Rights, or NCLR, filed a similar federal lawsuit on behalf of several transgender service members.

In addition, Lambda Legal and OutServe-SLDN on Monday filed a suit in Seattle federal court challenging the ban.

The ACLU suit argues Trump’s policy violates the equal protection rights of transgender service members who now have “grave reason to fear for their careers.”

The lawsuit also questions the premise for the ban and whether it is politically motivated.

It points out that Trump’s tweet suggests he made the decision about the ban after consulting with his generals and military experts who “cannot be burdened with the tremendous medical costs and disruption that transgender in the military would entail.”

However, the suit argues Trump provided no cost analysis and cites news reports suggesting top military officials were “surprised” by his announcement.

It also suggests Trump’s motivations were “purely political,” and that he was trying to get more votes in Congress to fund his U.S.-Mexico wall by appealing to members who morally disapprove of men and women who are transgender.

Transgender service members have been able to serve openly in the military since last year when then-Secretary of Defense Ash Carter, during the Obama administration, lifted the prior ban.

“In President Trump's judgment, the previous administration failed to identify a sufficient basis to conclude that terminating long-standing policy and practice would not hinder military effectiveness, disrupt unit cohesion, tax military resources,” a senior administration official said Friday.

The Associated Press contributed to this report.