The Pentagon on Thursday ended its ban on openly transgender people serving in the U.S. military, formally removing the risk to an estimated thousands of U.S. troops who once could have been kicked out of the armed forces due to gender identity.

The repeal, which ends one of the last barriers to serving in the military, comes after a 2011 decision to end the U.S. military's ban on openly gay and lesbian people serving, despite concerns - which proved unfounded - that such a move could be too great a burden in wartime and would undermine battle readiness.

"We're eliminating policies that can result in transgender members being treated differently from their peers based solely upon their gender identity rather than upon their ability to serve," Defense Secretary Ash Carter told reporters.

Carter said that within 90 days, the Pentagon would create a guidebook for commanders on rules regarding transgender service members and medical guidance to doctors.

Within one year, transgender individuals would be allowed to join the armed forces, provided they have been "stable" in their preferred gender for 18 months, he said.

Carter said that based on a study carried out by the RAND Corporation, there were about 2,500 transgender active-duty service members and 1,500 reserve transgender service members. Still, Rand's figures were within a range, which at the upper end reached 7,000 active duty forces and 4,000 reserves.

The RAND study, which was also released on Thursday, said the lifting of the ban would cost between $2.4 million and $8.4 million annually in medical care, but could reduce costs associated with mental health.

A Defense official, speaking on the condition of anonymity, said the Pentagon had not yet made a determination on what it would cost to make changes in military facilities, like potentially adding shower curtains, but that it would only be a onetime cost.

"The reality is that we have transgender service members serving in uniform today," Carter said, acknowledging the policy change will have implications for issues including deployment and medical treatment.

He added that at least 18 countries already allowed transgender personnel to serve openly in their militaries.

Carter announced last year that he intended to lift the ban and laid out a series of steps, including a six-month study on the implications of lifting the restrictions. But advocates for the lesbian, gay, bisexual and transgender community said the process, which eventually stretched to nearly a year, has taken too long.

Advocates praised Carter's announcement on Thursday and said it followed several moves by the military to be more inclusive in the last decade.

"I would hope that it showcases the fact that the sky will not fall, the world will not come apart, by us being a more inclusive and open society," said Matt Thorn, executive director of OutServe-SLDN, an advocacy group for LGBT military personnel. "I don't think anybody should be concerned or afraid about moving forward with this policy."

But critics have argued that Carter is putting the political agenda of the Democratic administration of President Barack Obama ahead of military readiness.

"Over the next few weeks, we are going to continue to push for actual answers to the readiness questions we’ve been asking for nearly a year to which we have still not received a response," Republican Representative Mac Thornberry, chairman of the House of Representatives Armed Services Committee, said in a statement.

(Reporting by Idrees Ali and Phil Stewart; Additional reporting by Yeganeh Torbati; Editing by Frances Kerry and Jonathan Oatis)