A US federal judge yesterday ordered an immediate end to Don’t Ask, Don’t Tell, the law that bans out gay soldiers from serving in the military.

US District Judge Virginia Phillips’ injunction brings the military the closest it has ever been to repealing the controversial law.

Her injunction tells the Pentagon to immediately stop enforcing the 1993 law and orders the Defence Department to halt any current investigation or discharge relating to a soldier’s sexual orientation.

The Justice Department has 60 days to respond to the order but has not yet commented. It may ask a higher court to stay the ruling while it appeals.

Judge Phillips, of California, made the ruling in a case brought by gay Republican group Log Cabin Republicans. She was asked by the Obama administration to limit her ruling to members of that group but rejected the request.

She ruled that the policy violated the First and Fifth Amendments and wrote that it “irreparably injures servicemembers by infringing their fundamental rights”.

President Obama is known to oppose Don’t Ask, Don’t Tell, but has rejected requests to end it through an executive order. Instead, he is seeking to repeal the law through Congress and a year-long Pentagon review of the policy is underway.

An estimated 13,500 soldiers have been dismissed under the law, which allows gay and lesbian soldiers to serve in the military but bars them from revealing they are gay. In many cases, dismissed soldiers had their sexual orientation revealed by a third party.

Opponents to repealing the law say it will harm recruitment, cohesion and morale at a time when the military is fighting in Iraq and Afghanistan.

The Log Cabin Republicans welcomed the ruling but urged soldiers not to declare their sexual orientation just yet, as they could be sacked if the Obama administration appeals.

Christian Berle, deputy executive director of the Republican gay group, said: “These soldiers, sailors, airmen, marines and coast guardsmen sacrifice so much in defence of our nation and our Constitution. It is imperative that their constitutional freedoms be protected as well.

“This decision is also a victory for all who support a strong national defence. No longer will our military be compelled to discharge servicemembers with valuable skills and experience because of an archaic policy mandating irrational discrimination.

“The United States is stronger because of this injunction, and Log Cabin Republicans is proud to have brought the case that made it possible.”