Related

Judge Virginia A. Phillips of Federal District Court for the Central District of California issued an injunction banning enforcement of the law and ordered the military to immediately “suspend and discontinue” any investigations or proceedings to dismiss service members.

In language much like that in her Sept. 9 ruling declaring the law unconstitutional, Judge Phillips wrote that the 17-year-old policy “infringes the fundamental rights of United States service members and prospective service members” and violates their rights of due process and freedom of speech.

While the decision is likely to be appealed by the government, the new ruling represents a significant milestone for gay rights in the United States.

Two other recent decisions have overturned restrictions on gay rights at the state and federal levels. Tuesday’s ruling, in Log Cabin Republicans v. United States of America, could have a potentially sweeping impact, as it would apply to all United States service members anywhere in the world.

Christian Berle, the acting executive director of the Log Cabin Republicans, a gay organization, applauded the judge’s action, saying it would make the armed forces stronger.

“Lifting the ban on open service will allow our armed forces to recruit the best and brightest,” Mr. Berle said, “and not have their hands tied because of an individual’s sexual orientation.”

Alexander Nicholson, the named plaintiff in the lawsuit, said “we sort of won the lottery,” considering the breadth of the decision. Mr. Nicholson is executive director of Servicemembers United, an organization of gay and lesbian troops and veterans.

The government has 60 days to file an appeal. “We’re reviewing it,” said Tracy Schmaler, a Justice Department spokeswoman, adding that there would be no other immediate comment. The government is expected, however, to appeal the injunction to the Court of Appeals for the Ninth Circuit to try to keep it from taking effect pending an appeal of the overall case.

Such a move would carry risks, said Richard Socarides, who was an adviser to President Bill Clinton on gay rights issues. “There will be an increasingly high price to pay politically for enforcing a law which 70 percent of the American people oppose and a core Democratic constituency abhors,” he said.

Critics of the ruling include Tony Perkins, the president of the Family Research Council and a proponent of the don’t ask, don’t tell law, who accused Judge Phillips of “playing politics with our national defense.”

In a statement, Mr. Perkins, a former Marine, said that “once again, an activist federal judge is using the military to advance a liberal social agenda,” and noted that there was still “strong opposition” to changing the law from military leaders.

Mr. Perkins predicted that the decision would have wide-ranging effects in the coming elections. “This move will only further the desire of voters to change Congress,” he said. “Americans are upset and want to change Congress and the face of government because of activist judges and arrogant politicians who will not listen to the convictions of most Americans and, as importantly, the Constitution’s limits on what the courts and Congress can and cannot do.”

The don’t ask, don’t tell law was originally proposed as a compromise measure to loosen military policies regarding homosexuality. Departing from a decades-old policy of banning service by gay, lesbian and bisexual recruits, the new law allowed service and prohibited superiors from asking about sexual orientation. But the law also held that service members could be dismissed from the military if they revealed their sexual orientation or engaged in homosexual acts.

Since 1993, some 14,000 gay men and lesbians have been discharged from the service when their sexual orientation became known, according to Mr. Nicholson’s group.

The law has long been a point of contention, and President Obama has asked Congress to repeal it.

At an afternoon briefing on Tuesday, the White House press secretary, Robert Gibbs, said the injunction was under review, but that “the president will continue to work as hard as he can to change the law that he believes is fundamentally unfair.”

The Department of Justice, however, is required to defend laws passed by Congress under most circumstances.

The House voted to do so in May, but last month the Senate voted not to take up the bill allowing repeal. Advocates for repeal have pushed for that vote to be reconsidered after the midterm elections.

Jim Manley, a spokesman for the Senate majority leader, Harry Reid, said, “Senator Reid is encouraged by the decision, and still hopes to be able to take the bill to the floor after the elections in November.”

Mr. Gates was on an official visit to Vietnam when Judge Phillips’s action was announced on Tuesday. “We have just learned of the ruling and are now studying it,” said Geoff Morrell, the Pentagon press secretary. “We will be in consultation with the Department of Justice about how best to proceed.”

After her initial ruling in September, Judge Phillips, who was appointed by Mr. Clinton, sought recommendations from the parties as to what kind of legal relief should follow.

Arguing that “the United States is not a typical defendant, and a court must exercise caution before entering an order that would limit the ability of the government to enforce a law duly enacted by Congress,” the Justice Department noted that the law had been found constitutional in other courts.

It asked that the judge’s injunction apply only to members of Log Cabin Republicans and not to the military over all.

While Mr. Obama has been critical of the Defense of Marriage Act, the Justice Department has defended it in the federal court challenge. On Tuesday, the department filed an appeal in the case and issued a statement that might well be echoed in coming weeks in the military case.

“As a policy matter, the president has made clear that he believes DOMA is discriminatory and should be repealed,” said Ms. Schmaler, the department spokeswoman. “The Justice Department is defending the statute, as it traditionally does when acts of Congress are challenged.”

Advocates for gay rights said they were cheered by the direction of the three recent rulings.

Chad Griffin, the board president of the American Foundation for Equal Rights, which sponsored the litigation against California’s same-sex marriage ban, said that “with the momentum of these three court decisions, I think it really is the beginning of the end of state-sanctioned discrimination in this country.”

A version of this article appeared in print on October 13, 2010, on page A1 of the New York edition.