A federal judge in Southern California declared the US military's ban on openly gay service members to be unconstitutional.
US District Judge Virginia Phillips granted a request for an injunction halting the government's "don't ask, don't tell" policy for gays in the military.
Ms Phillips said the policy does not help military readiness and instead has a "direct and deleterious effect" on the armed services.
The lawsuit was the biggest legal test of the law in recent years and came amid promises by President Barack Obama that he will work to repeal the policy.
Government lawyers argued Ms Phillips lacked the authority to issue a nationwide injunction and the issue should be decided by Congress.
The injunction was sought by the Log Cabin Republicans, a 19,000-member group that includes current and former military members.