Image caption Iraq veterans including Lt Dan Choi were among those discharged under the policy

A US judge has ordered a nationwide halt to enforcement of the country's ban on openly gay military personnel.

US District Judge Virginia Phillips last month ruled the "don't ask, don't tell" policy unconstitutional.

Under the policy, gay people can serve in the military but face expulsion if their sexuality is discovered.

President Barack Obama and some military leaders have called for it to be overturned. A legislative attempt to do so failed in the Senate last month.

The US Department of Justice has 60 days to appeal but may opt not to do so.

Last month the ban was also ruled unconstitutional by a federal court in Washington state. A judge there ordered the US Air Force to reinstate a nurse sacked under the policy.

Analysis The judge's ruling means that any proceedings under way involving active US service members anywhere in the world must be discontinued, and anyone who was about to be discharged from the service because of "don't ask, don't tell" will earn a reprieve. Her decision pre-empts the outcome of an ongoing Pentagon inquiry into the effect of repealing the policy. That report isn't due out until December, and although Mr Obama had said he would like to see an end to the ban, he is also of the opinion that it should be Congress - and not the courts - which determines military policy. The dilemma now is that by maintaining that stance and potentially appealing against the judge's decision, Mr Obama's Democratic Party risks alienating the strong support it enjoys from gay rights activists in the run-up to next month's crucial mid-term elections.

Meanwhile, the Pentagon has been studying how gay people can be integrated into the US military and is to report on its findings later this year.

Under the policy, established in 1993 under former President Bill Clinton, the US military is forbidden to inquire about service members' sexual orientation, but can expel people discovered to be homosexual.

The lawsuit was brought by the Log Cabin Republicans, a pro-gay Republican group, on behalf of openly gay military personnel who had been discharged under the policy.

Supporters of the ban say allowing gay people to serve openly in the US military would lower troop morale and hinder military readiness.

Judge Phillips declared the policy unconstitutional after a brief trial last month.

Government attorneys objected to an immediate, nationwide injunction, arguing it might harm military operations during wartime.

Overturning the ban, Judge Phillips cited Mr Obama's contention that it weakened national security by forcing qualified military personnel to "live a lie" or have their careers compromised.

Gay people in the US military President Bill Clinton wanted to lift the ban on gay people in the military

After staunch opposition, compromise "don't ask, don't tell" policy passed in 1993

Between 1997 and 2008, 10,500 service members discharged under rules

President Barack Obama pledged to repeal the policy

Pentagon review announced in February 2010

Among other flaws, she found the policy improperly restricted gay military personnel's ability to speak about their lives and their personal relationships.

"It distinguishes between speech regarding sexual orientation, and inevitably, family relationships and daily activities, by and about gay and lesbian servicemembers, which is banned, and speech on those subjects by and about heterosexual servicemembers, which is permitted," Judge Phillips wrote.

Britain, Israel and dozens of other countries allow gay personnel to serve openly.