The advocacy group OutServe-SLDN said Wednesday it is prepared to sue the Trump administration if the president follows through with a declared ban on transgender troops in the military.

"If the president pushes this, we will take him to court," said Matt Thorn, the executive director of OutServe-SLDN, which provides legal services to lesbian, gay, bisexual, and transgender members of the military.

President Trump's tweets announcing a ban on all transgender service broadsided the group Wednesday morning, Thorn said, just a few weeks after Defense Secretary Jim Mattis said the military was committed to integrating those troops.

"After consultation with my Generals and military experts, please be advised that the United States Government will not accept or allow transgender individuals to serve in any capacity in the U.S. Military," Trump wrote. "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."

Thorn said he does not believe Trump has the authority to institute a ban and that it would have to come from Mattis.

"I think this is an overreach," he said.

Aaron Belkin, director of the Palm Center, said Trump just created a worse version of "Don't Ask, Don't Tell."

"The President is creating a worse version of 'don't ask, don't tell.' As we know from the sad history of that discredited policy, discrimination harms military readiness," Belkin said. "This is a shocking and ignorant attack on our military and on transgender troops who have been serving honorably and effectively for the past year.

"As former Chairman of the Joint Chiefs of Staff Mike Mullen stated yesterday, their service must be respected. The Rand Corporation has estimated that the cost of medical care for transgender troops is approximately one one-hundredth of one percent of the military annual health care budget, or at most, $8.4 million per year. To claim otherwise is to lie about the data."

The American Military Partner Association called it an "attack."

"This is a horrifying, vicious attack on thousands of actively serving troops in the military who happen to be transgender," said AMPA President Ashley Broadway-Mack. "Transgender service members are risking their lives around the world, and President Trump literally just put a target on their backs, threatening to ruin their careers and kick them out of the military. This is unconscionable, and we are beyond outraged."