President Barack Obama ordered his administration on Wednesday to stop defending the constitutionality of a federal law that bans recognition of gay marriage, a policy reversal that could have major implications for the rights and benefits of gay couples and reignite an emotional debate for the 2012 presidential campaign.

Obama still is "grappling" with his personal views on whether gays should be allowed to marry but has long opposed the federal law as unnecessary and unfair, said spokesman Jay Carney.

First word of the change came not from the White House but from the Justice Department. Attorney General Eric Holder announced that Obama had concluded the 15-year-old Defense of Marriage Act, or DOMA, was legally indefensible.

The decision was immediately welcomed by gay rights organizations and vilified by those on the other side. Some Democrats in Congress praised the decision, while it drew criticism from some Republicans and the office of their leader, House Speaker John Boehner, all surely a preview of coming political debate over the latest development in the long-running national conversation about gay rights.

The outcome of that debate could have enormous impact because federal laws and regulations confer more than a thousand rights or benefits on those who are married, most involving taxpayer money _ Social Security survivors' benefits, family and medical leave, equal compensation as federal employees and immigration rights.

"Much of the legal landscape has changed in the 15 years since Congress passed DOMA," Holder said in a statement explaining the decision.

As well, the social landscape has changed.

Since the law was passed in 1996, five states and the District of Columbia have approved gay marriage, and others allow civil unions. An Associated Press-National Constitution Center Poll conducted last August found 52 percent of Americans saying the federal government should give legal recognition to marriages between couples of the same sex.

Thirty states have constitutional amendments banning gay marriage. Same-sex marriage is legal in Connecticut, Iowa, Massachusetts, New Hampshire, Vermont and Washington, D.C.

The White House framed Obama's decision as one brought on by a legal deadline in one of several federal court cases challenging the constitutionality of the law which defines marriage as only between a man and a woman.

But Sen. Jim DeMint, R-S.C., speculated Obama's decision was motivated more by political considerations: "It's only in the run-up to re-election that he's suddenly changed his mind."

Obama's reversal on this law had long been sought by gays, who overwhelmingly voted

for his election in 2008.

The Justice Department had defended the act in court until now. But Holder said Obama concluded the law fails to meet a rigorous standard under which courts view with suspicion any laws targeting minority groups, such as gays, who have suffered a history of discrimination _ a stricter standard of scrutiny than the department has applied in the past.

Looking back to Congress' debate on the legislation, Holder said it was clear that there were "numerous expressions reflecting moral disapproval of gays and lesbians and their intimate and family relationships _ precisely the kind of stereotype-based thinking and animus the (Constitution's) Equal Protection Clause is designed to guard against."

Gay rights activists noted that the president's move came just two months after Congress, urged on by the administration, voted to repeal the "don't ask, don't tell" policy that prevented gays from serving openly in the military.

"This major turn should be a final nail in the coffin for the different treatment of gay and non-gay people by the federal government," said law professor Suzanne Goldberg, director of Columbia University's Center for Gender and Sexuality Law.

Rea Carey, executive director of the National Gay and Lesbian Task Force, called the change "a tremendous step toward recognizing our common humanity and ending an egregious injustice against thousands of loving, committed couples who simply want the protections, rights and responsibilities afforded other married couples."

On the other side of the debate, reaction was vehement.

"On the one hand this is a truly shocking extra-constitutional power grab in declaring gay people are a protected class," said Maggie Gallagher of the conservative National Organization for Marriage. "The good news is this now clears the way for the House to intervene and to get lawyers in the courtroom who actually want to defend the law, and not please their powerful political special interests."

Boehner's spokesman, Michael Steel, issued a statement faulting Obama for stirring up the issue "while Americans want Washington to focus on creating jobs and cutting spending."

For now the law remains on the books, while challenges work through the courts. But Sen. Dianne Feinstein, D-Calif., announced plans to introduce legislation to repeal it.

"My own belief is that when two people love each other and enter the contract of marriage, the federal government should honor that," she said.

At a December news conference, Obama said that his position on gay marriage was "constantly evolving." He has opposed such marriages and supported instead civil unions for gay and lesbian couples. The president said such civil unions are his baseline _ at this point, as he put it.

"This is something that we're going to continue to debate, and I personally am going to continue to wrestle with going forward," he said

Marriage law in the U.S. historically has been a matter left to the states, but the federal law bars recognition of them by the federal government.

Thus a same-sex married couple in Vermont could file a joint state tax return but had to file their U.S. tax forms separately. Similarly, legally married same-sex spouses might be ordered to proceed separately though customs and immigrations checkpoints when returning to the U.S. from abroad, and a gay American married to a foreigner could not be sure that the spouse would be allowed to immigrate.

Among those affected by DOMA were a lesbian couple from New York City _ Edith Windsor and Thea Spyer. After four decades together, they married in Canada in 2007, and that marriage was recognized in New York.

However, it was not recognized by the federal government. One result, according to lawsuit filed by the American Civil Liberties Union, was a $350,000 federal tax on Spyer's estate when she died in 2009 that Windsor would not have had to pay if she were in a heterosexual marriage.

Windsor said she was elated by the Justice Department announcement.

"My only regret is that my beloved late spouse ... isn't here today to share in this historic moment," she said. "But in my heart, I feel that she knows."

The attorney general said the department will immediately bring the policy change to the attention of the federal courts now hearing Windsor's challenge in New York City and another case in Connecticut that challenges the federal government's denial of marriage-related protections for federal Family Medical Leave Act benefits, federal laws for private pension plans and federal laws concerning state pension plans.

Those two courts are in the nation's 2nd judicial circuit, where the circuit court has not ruled on the standard for judging this law. In Massachusetts, where the U.S. 1st Circuit Court has accepted the lower standard of scrutiny, which requires only a "rational basis" for the law, a federal district judge found the act to be unconstitutional. On appeal last month, the Justice Department argued in court papers that the Defense of Marriage Act was Congress' reasonable response to a debate among the states on same-sex marriage.

Jerry Savoy, a Connecticut man in a same-sex marriage who is among those challenging the law, welcomed Obama's action, saying he and his spouse were "no different than any other family living on our street." Savoy, a lawyer for a federal agency, said that because of the law he cannot include his spouse on his employer-provided health insurance.

___

Associated Press writers David Crary in New York and Stephen Singer in Hartford, Conn., contributed to this report.