President Trump on Friday officially authorized the ability to ban transgender individuals from joining the military, with limited exceptions, following through on a pledge he made last year.

“Among other things, the policies set forth by the Secretary of Defense state that transgender persons with a history or diagnosis of gender dysphoria — individuals who the policies state may require substantial medical treatment, including medications and surgery — are disqualified from military service except under certain limited circumstances,” a memorandum released by the White House Friday night said.

Defense Secretary Jim Mattis in February sent Trump a memorandum laying out policies that “in the exercise of his independent judgment” should be implemented by the Defense Department.

In July, Trump tweeted that the federal government “will not accept or allow transgender individuals to serve in any capacity in the U.S. Military” – reversing a 2016 policy under President Barack Obama. The move caught the Pentagon by surprise.

“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,” the president said at the time.

Trump’s push for the ban has been blocked by several legal challenges and the Pentagon began allowing transgender recruits to seek enlistment in January.

Fox News’ Lucas Tomlinson, Lukas Mikelionis and The Associated Press contributed to this report.