On Friday night, President Donald Trump issued a memorandum seeking to ban nearly all transgender Americans from serving in the U.S. military, a move that the White House said would “enhance our military’s readiness, lethality, and effectiveness.”

The president’s actions on Friday follow through with a tweet, sent in July 2017, declaring that he would no longer allow “transgender individuals to serve in any capacity in the U.S. Military.”

The memo, filed in U.S. District Court in Seattle and released shortly after President Trump landed for a weekend vacation in Palm Beach, Florida, declared that “the accession or retention of individuals with a history or diagnosis of gender dysphoria—those who may require substantial medical treatment, including through medical drugs or surgery—presents considerable risk to military effectiveness and lethality.”

The memo did not say what would happen to the thousands of transgender troops estimated to currently serve in the military, although the president did cite the recommendations of Secretary of Defense James Mattis. In February, Mattis issued a report on transgender troops, citing his own “personal judgment,” calling on the Pentagon to bar almost all transgender troops from military service, with a few narrow caveats.

“I firmly believe that compelling behavioral health reasons require the Department to proceed with caution before compounding the significant challenges inherent in treating gender dysphoria with the unique, highly stressful circumstances of military training and combat operations,” Mattis said. “Preservation of unit cohesion, absolutely essential to military effectiveness and lethality, also reaffirms this conclusion.”

Therefore, Mattis continued, the Department of Defense should view all transgender people with “a history or diagnosis of gender dysphoria” as disqualified from military service, unless they have been “stable” in their “biological sex” for 36 months prior to accession into the military, or are willing to be deployed without “a change of gender.”

Currently serving transgender individuals, Mattis recommended, “may continue to serve in their preferred gender and receive medically necessary treatment for gender dysphoria.”

Transgender persons who require or have undergone gender transition, Mattis concluded, “are disqualified from military service.”

LGBTQ groups immediatey condemned the president’s decision, dubbing the memorandum “transphobia masquerading as policy.”

“This policy is not based on an evaluation of new evidence,” Joshua Block, a senior staff attorney at the American Civil Liberties Union’s LGBT & HIV Project, said in a statement. “It is reverse-engineered for the sole purpose of carrying out President Trump’s reckless and unconstitutional ban, undermining the ability of transgender service members to serve openly and military readiness as a whole.”

Peter Renn, a senior attorney with LGBTQ legal advocacy group Lambda Legal, dismissed the plan as “nothing more than a transparent ruse cobbled together with spittle and duct tape designed solely to try to mask discrimination.”

“A plan to implement an unconstitutional decree,” Renn continued, “is an unconstitutional plan.”

In his initial tweet declaring the ban, Trump said that U.S. armed forced could not afford the “tremendous medical costs and disruption” of transgender service members, but a 2016 study commissioned by the Department of Defense refuted that assertion. The Rand Corporation released a study, commissioned by the Pentagon, evaluating the potential effects transgender troops would have on unit cohesion, military readiness, and the overall military budget.

That study found that medical treatments for trans servicemembers would cost the military between $2.4 million and $8.4 million annually.

By comparison, the Department of Defense spent $84.24 million on erectile dysfunction prescriptions in 2014.