(CNN) -- A federal court in Riverside, California, ruled Thursday that the military's "don't ask, don't tell" policy -- which bars gay men and lesbians from serving openly -- is unconstitutional.

"Plaintiff has demonstrated it is entitled to the relief sought on behalf of its members, a judicial declaration that the don't ask, don't tell act violates the Fifth and First Amendments, and a permanent injunction barring its enforcement," concluded U.S. District Judge Virginia Phillips, a 1999 Clinton appointee.

The 85-page ruling came in a case filed by the group Log Cabin Republicans against the government and Secretary of Defense Robert M. Gates.

"The act discriminates based on the content of the speech being regulated," Phillips wrote. "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."

But, she noted, "the sweeping reach of the restrictions on speech in the don't ask, don't tell act is far broader than is reasonably necessary to protect the substantial government interest at stake here."

Then, citing examples provided by witnesses, she concluded that "the act's restrictions on speech not only are broader than reasonably necessary to protect the government's substantial interests, but also actually serve to impede military readiness and unit cohesion rather than further these goals."

The next step is expected to be for the government to ask for a temporary injunction to prevent the ruling from going into immediate effect, pending further appeals. The government at some point in the next few weeks or months would then file a petition with the 9th Circuit U.S. Court of Appeals, which is based in San Francisco, for a hearing. If the government were to lose, its next step would be to the Supreme Court.

But since the Pentagon and White House have signaled their intention to end don't ask, don't tell, with congressional approval, Thursday's ruling may be viewed in a different light.

Servicemembers United, which describes itself as the nation's largest organization of gay and lesbian troops and veterans, hailed the announcement.

"This is an historic moment and an historic ruling for the gay military community and for the readiness and integrity of our armed forces," said Alexander Nicholson, executive director of the group and a former multi-lingual U.S. Army interrogator who was discharged under don't ask, don't tell.

"As the only named injured party in this case, I am exceedingly proud to have been able to represent all who have been impacted and had their lives ruined by this blatantly unconstitutional policy. We are finally on our way to vindication."

CNN's Bill Mears contributed to this story.