The Pentagon announced Monday that it will allow transgender members of the military to serve openly starting next year, marking an end to a long-standing policy that barred them from the armed forces.

In an echo of the Defense Department's repeal of the ban on gays in uniform four years ago, Defense Secretary Ashton B. Carter said he had directed the armed forces to devise new rules over the next six months that would allow transgender troops to serve, except in situations "where objective, practical impediments are identified."

"We must ensure that everyone who's able and willing to serve has the full and equal opportunity to do so, and we must treat all our people with the dignity and respect they deserve," Carter said in a statement. He called the military's current regulations "outdated" and said they were "causing uncertainty that distracts commanders from our core missions."

Carter also issued a directive that would make it more difficult to discharge transgender personnel over the next six months while the new rules are being established, requiring all such cases to be reviewed by a senior Pentagon official. The Pentagon took a similar interim approach to freeze the discharges of gay troops while it was preparing to lift that ban five years ago.

An estimated 15,500 transgender people serve in the military, but they have been forced to conceal that identity, according to the Williams Institute, a center at the University of California at Los Angeles that studies the gay and transgender populations. Some have found themselves in a precarious position — open to sympathetic peers and superiors but at risk of being discharged if someone who disapproves finds out.

Over the years, military officials have said the ban was necessary to protect troops in "austere environments" where they may not have easy access to medical care. Supporters of the ban have also suggested that transgender people may have mental deficiencies and be at ri sk of suicide.

But pressure has mounted on the military and the Obama administration in recent years as societal views of transgender people have changed, and since the relatively smooth transition after the 2011 lifting of "don't ask, don't tell," the policy that barred gays from openly serving.

Gay rights groups praised the decision, which they said was long overdue. They noted that several other countries, including Israel, Canada, Britain and Australia, have successfully incorporated transgender members in their ranks and predicted that a policy change in the United States would be relatively simple.

"It shouldn't be complicated," said Allyson Robinson, an Army veteran and director of policy for SPARTA, a group that advocates for transgender troops. In these countries, transgender troops "have served openly for some time, and they've already proven that questions about ability or physical capabilities aren't rooted in practicalities, they are rooted in ignorance and bias."

The review will include a look at the impact on troops serving in close quarters and how a change in policy might play out in combat zones. At the moment, the Defense Department is also grappling with more general questions about the extent to which women can serve in direct combat roles — an issue that could be complicated by adding transgender members to the mix.

Some in Congress said they want to ensure that the Pentagon carefully considers over the next six months whether there are certain missions or assignments in war zones where allowing transgender troops to serve might be problematic.

"It has to be an honest review," said a congressional aide who spoke on the condition of anonymity to discuss internal deliberations. "It just can't be 'We took a look and there will be no challenges with this.' "

The decision drew immediate rebukes from groups that said it was evidence of the Obama adminstration's misplaced priorities.

"It's time that we allow the military to focus on its only job — defending our country against its enemies," Jerry Boy­kin, a retired Army lieutenant general and executive vice president of the Family Research Council, said in a statement.

But Rep. Adam Smith (Wash.), the senior Democrat on the House Armed Services Committee, welcomed the change and its stated presumption that allowing transgender troops to serve would not harm the effectiveness of military units. "It is long past time that we definitively and affirmatively make it clear that gender identity should have no bearing on an individual's ability to serve," he said.

The military banned service members with gender issues as early as the 1960s, said Aaron Belkin, director of the Palm Center, a gay rights group. By the 1980s, he said, the military was applying its medical regulations more forcefully against people who identified as transgender.

Gay rights groups have aggressively pushed back in recent years, pointing to studies and reports that show open transgender service would not be harmful. Among them was a report last year co-authored by former U.S. surgeon general Joycelyn Elders. "There is no compelling medical reason for the ban," the report concluded.

In recent months, there were signs that the military was changing course on the issue, with the Army, Navy and Air Force adjusting their policies to make it more difficult to discharge transgender members. Shortly after Carter was sworn in as defense secretary this year, he suggested at a town hall meeting with troops in Afghanistan that he was "open-minded" about transgender service.

In addition, last month, a senior airman attended the White House's gay pride celebration in the uniform of his preferred gender, which is a departure from current Air Force policy, groups said.

The policy change announced Monday, which was first reported by the Associated Press, comes two weeks after the U.S. Supreme Court ruled that same-sex couples have a constitutional right to marry.

Army Capt. Jacob Eleazer, who joined as a woman and now identifies as a man, greeted the news Monday with relief. For years he has gone back and forth with leadership over his gender identity, at times fearing he would be dismissed. Most recently, he said, he was admonished for allowing officer candidates to address him as "sir."

He said he hopes the decision announced Monday will end the standoff and allow him to serve in the military longer than he expected.

"Basically, it means I'm going to have an opportunity to have a career I never thought I would," he said. "This is really good news."

Sandhya Somashekhar is the social change reporter for the Washington Post.

Craig Whitlock covers the Pentagon and national security. He has reported for The Washington Post since 1998.