The Supreme Court on Wednesday struck down the federal Defense of Marriage Act and declined to rule on California’s ban on same-sex marriage, historic moves that significantly expand the rights of gays and lesbians in the country.

The justices ruled DOMA unconstitutional and said it didn’t have authority to hear a case challenging California’s Proposition 8 law. The end result is seen as a long-sought victory for gay-rights advocates who have pushed for the legalization of same-sex marriage.

The high court’s rulings, both 5-4 votes, don’t give gays and lesbians the constitutional right to marry. But they keep state-level same-sex marriage laws in the in place and sets up a legal pathway for more states to do so.

DOMA, a 1996 law that defines marriage as the union of a man and a woman, had kept legally married gay Americans from collecting a range of federal benefits that generally are available to married people.

Justice Anthony Kennedy wrote the majority opinion in the DOMA case, saying the law “violates basic due process and equal protection principles applicable to the federal government.”

“Under DOMA same-sex married couples have their lives burdened, by reason of government decree, in visible and public ways,” Kennedy wrote.

He was joined by the court’s four liberal-leaning justices: Elena Kagan, Sonia Sotomayor, Ruth Bader Ginsburg and Stephen Breyer.

President Obama applauded the court’s decision to throw out DOMA, saying it was “discrimination enshrined in law.”

“It treated loving, committed gay and lesbian couples as a separate and lesser class of people,” the president said. “The Supreme Court has righted that wrong, and our country is better off for it.”

While the Clinton and Bush administrations backed the law, Obama in 2011 instructed the Justice Department to stop defending it. House Republican leadership then stepped in to bankroll DOMA’s defense, spending about $3 million.

House Speaker John Boehner, R-Ohio, said the while he was “obviously disappointed” in the ruling, “it is always critical that we protect our system of checks and balances.”

“A robust national debate over marriage will continue in the public square, and it is my hope that states will define marriage as the union between one man and one woman,” he said.

Former Republican Arkansas Gov. Mike Huckabee, a leading voice in conservative evangelical movement, was less muted in his disappointment, posting on Twitter that “Jesus wept.”

On Proposition 8, the court dismissed the case by saying that the parties defending Proposition 8 didn’t have the right to appeal the lower court’s ruling. The state has refused to defend it, so a group called stepped in to do so.

While the justices avoided making a sweeping decision on the constitutionality of gay marriage restrictions, their move leaves in place a lower court’s ruling that Proposition 8 is unconstitutional. But the ruling almost certainly will spur further legal battles.

Chief Justice John Roberts read the court’s opinion dismissing the Proposition 8 case on the basis that the “petitioners did not have standing to appeal the District Court’s order.”