AUSTIN, Texas (AP) — A federal judge declared Texas' ban on gay marriage unconstitutional Wednesday, but left it in place until an appeals court can rule on the case.

Judge Orlando Garcia issued the preliminary injunction after two gay couples challenged a state constitutional amendment and a longstanding law. He said the couples are likely to win their case and the ban should be lifted, but said he would give the state time to appeal to the 5th Circuit Court of Appeals before do so.

"Without a rational relation to a legitimate governmental purpose, state-imposed inequality can find no refuge in our United States Constitution," Garcia wrote. "These Texas laws deny plaintiffs access to the institution of marriage and its numerous rights, privileges, and responsibilities for the sole reason that Plaintiffs wish to be married to a person of the same sex."

The ruling is the latest in a series of victories for gay rights activists following similar decisions in Utah, Oklahoma and Virginia.

But this was the first time a court in the conservative 5th Circuit has reached such a decision. Texas Attorney General Greg Abbott was expected to file an expedited appeal.

Mark Phariss and Victor Holmes filed their federal civil rights lawsuit saying Texas' ban unconstitutionally denied them the fundamental right to marry because of their sexual orientation. Cleopatra De Leon and Nicole Dimetman filed a lawsuit saying Texas officials were violating their rights by not recognizing their marriage conducted in a state where gay marriage is legal.

Attorneys for the state argued that Texas voters had imposed the ban through a referendum and that Texas officials were within their rights to defend marriage traditions.

Another gay couple has filed a separate lawsuit in federal court in Austin. In that case, two men argue that the ban discriminates against them based on their gender. That case is scheduled for a hearing later this year.