In a 5-4 ruling, the United States Supreme Court justices strike down the Defense of Marriage Act, saying it is unconstitutional. NBC's Pete Williams reports.

In a pair of landmark decisions, the Supreme Court on Wednesday struck down the 1996 law blocking federal recognition of gay marriage, and it allowed gay marriage to resume in California by declining to decide a separate case.

The court invalidated the Defense of Marriage Act, which denied federal benefits to gay couples who are legally married in their states, including Social Security survivor benefits, immigration rights and family leave.

Justice Anthony Kennedy, writing for the majority in a 5-4 decision, said that the act wrote inequality into federal law and violated the Fifth Amendment’s protection of equal liberty.

“DOMA’s principal effect is to identify a subset of state-sanctioned marriages and make them unequal,” he wrote.

Edith Windsor, the 84-year-old woman who brought the case against DOMA, said that the ruling ensured that the federal government could no longer discriminate against the marriages of gays and lesbians.

“Children born today will grow up in a world without DOMA, and those same children who happen to be gay will be free to love and get married,” she said.

In the second case, the court said that it could not rule on a challenge to Proposition 8, a ban on gay marriage in California passed by voters there in 2008, because supporters of the ban lacked the legal standing to appeal a lower court’s decision against it.

The court did not rule on the constitutionality of gay marriage, but the effect of the decision will be to allow same-sex marriage to resume in California. That decision was also 5-4, written by Chief Justice John Roberts.

Lt. Gavin Newsom told NBC News that gay marriage would resume in California within 30 days. Gov. Jerry Brown said counties could begin issuing marriage licenses to gay couples as soon as one formality was taken care of: A federal appeals court had to lift a stay issued by a lower judge.

“As soon as they lift that stay, marriages are on,” California Attorney General Kamala Harris told reporters. “The wedding bells will ring.”

Slideshow: Supreme Court rules in favor of same-sex marriage J. Scott Applewhite / AP Celebrations around the nation as the Supreme Court struck down the Defense of Marriage Act (DOMA) and declined to rule on California's Prop 8, legalizing same-sex marriage in the state. Launch slideshow

The two rulings, released minutes apart, were greeted by jubilant cheers outside the Supreme Court, where crowds of gay-marriage supporters waved rainbow banners and flags bearing symbols of equality, and at City Hall in San Francisco.

“The underlying message, I think, is that these are marriages, these are relationships, that are worthy of equal respect,” said Tom Goldstein, the publisher of SCOTUSblog and a Supreme Court analyst for NBC News. “It really does send a powerful message to the country that this is something that deserves fair treatment.

President Barack Obama placed a phone call from Air Force One to the two gay couples who had challenged Proposition 8. He told them, “We’re proud of you guys.” Paul Katami, one of the challengers, invited the president to his wedding to his partner, Jeff Zarrillo.

David Boies, a lawyer who argued against Proposition 8, said that the rulings took the country closer to realizing the Declaration of Independence’s guarantee that all men are created equal.

“It’s a wonderful day for America,” he said.

The decisions were handed down 10 years to the day after the court decided Lawrence v. Texas, which struck down anti-sodomy laws across the country. They also came just ahead of the weekend when many large cities celebrate gay pride by observing the anniversary of the Stonewall riots, considered the beginning of the gay rights movement.

Opponents of gay marriage vowed to fight on in the states.

“We clearly have a mixed ruling here,” said John Eastman, chairman of the National Organization for Marriage. “Justice Kennedy did not say that all states must recognize same-sex marriage. In fact, his opinion is full of deference to the states’ determination of marriage policy.”

Under the Defense of Marriage Act, gay couples who are legally married in their states were not considered married in the eyes of the federal government, and were ineligible for the federal benefits that come with marriage. Not counting California, 12 states and the District of Columbia have authorized gay marriage.

The law had helped determine who is covered by more than 1,100 federal laws, programs and benefits. They include a tax exemption for health benefits for gay spouses, and the right to petition the government for a green card. Defense Secretary Chuck Hagel said he was looking forward to extending benefits to gay military spouses.

All had been prohibited under DOMA. The Supreme Court ruling said that the law had instructed federal officials, “and indeed all persons with whom same-sex couples interact, including their own children, that their marriage is less worthy than the marriages of others.”

The case before the Supreme Court concerned Windsor and Thea Spyer, a lesbian couple who lived together in New York for 44 years and married in Canada in 2007. When Spyer died in 2009, Windsor was hit with $363,000 in federal estate taxes. Had the couple been considered by the federal government to be married, Windsor would not have incurred those taxes.

“We won everything we asked and hoped for,” Windsor told reporters.

Kennedy was joined in the majority by the four members of the court’s liberal wing — Justices Ruth Bader Ginsburg, Stephen Breyer, Sonia Sotomayor and Elena Kagan. Dissenting were Roberts and Justices Antonin Scalia, Clarence Thomas and Samuel Alito.

Scalia, in his dissent, wrote: “It is enough to say that the Constitution neither requires nor forbids ou rsociety to approve of same-sex marriage, much as it neither requires nor forbids us to approve of no-fault divorce, polygamy, or the consumption of alcohol.”

President Bill Clinton signed the act into law in September 1996. A court ruling in Hawaii had raised the prospect that that state might become the first to authorize gay marriage. Some members of Congress believed that the law might take the air out of a movement to amend the Constitution to block gay marriage.

Proposition 8, the California ban, was approved by voters in 2008 with 52 percent of the vote. The measure was placed on the ballot after the California Supreme Court allowed same-sex marriage.

The push to overturn it drew endorsements from what might have seemed unusual quarters just a few years ago.

In the days before the Prop 8 case was argued, politicians, business leaders, professional athletes and other high-profile figures rushed to announce their support for gay marriage.

Dozens of Republicans added their names to a paper known as a friend-of-the-court brief that argued that gay marriage promotes the conservative values of stability and mutual obligation.

And the case itself was argued, up through the federal court system, by two unlikely partners: Boies and Theodore Olson, the lawyers on opposing sides of Bush v. Gore, the Supreme Court case that settled the 2000 presidential election.

Gabe Gutierrez of NBC News contributed to this report.