A federal judge in Massachusetts has thrown a hand grenade into the middle of the culture war.

By ruling Thursday that the Defense of Marriage Act – which bars the federal government from recognizing gay marriage – is unconstitutional, US District Court Judge Joseph Tauro has also shined a spotlight on how the Obama administration is working at cross-purposes on the law.

President Obama has called the law known as DOMA “abhorrent” and pledged to overturn it. But his Justice Department has defended the law’s constitutionality in court – and is expected to appeal Judge Tauro’s ruling to the US Court of Appeals for the First Circuit.

“While we expect the department to continue to defend DOMA on appeal, we urge the Obama administration to push Congress to repeal a law that we know, and Judge Tauro recognized, serves no purpose but to denigrate our families,” the Human Rights Campaign, the nation’s largest gay rights organization, said in a statement.

Ruling in two cases, the judge found that DOMA encroaches on Massachusetts’ right to grant benefits to same-sex married couples that are already afforded to heterosexual couples. In one case, brought by state Attorney General Martha Coakley, the judge found that the 1996 law forces Massachusetts to discriminate against some of its own citizens – gay married couples – in order to receive federal money for programs such as Medicaid. Massachusetts legalized gay marriage in 2004.

“This court has determined that it is clearly within the authority of the commonwealth to recognize same-sex marriages among its residents, and to afford those individuals in same-sex marriages any benefits, rights, and privileges to which they are entitled by virtue of their marital status,” Tauro wrote. “The federal government, by enacting and enforcing DOMA, plainly encroaches upon the firmly entrenched province of the state.”

In the other case, brought by Gay and Lesbian Advocates and Defenders, the judge said the law violated the equal protection clause of the Constitution.

Elsewhere, in California, a ruling is expected soon in federal court on whether Proposition 8, the state’s ban on same-sex marriage, violates the Constitution.

All these cases have the potential to reach the Supreme Court. If pro-gay-marriage rulings are upheld there, it would mark a dramatic expansion of constitutional protection afforded same-sex couples. Conservative groups expressed confidence that the rulings would be overturned on appeal.

“The federal DOMA does not violate equal protection principles and has not interfered with Massachusetts' freedom to determine its own definition of marriage,” Tom McClusky, senior vice president of the Family Research Council, said in a statement.

Mr. McClusky also attributed the judge’s ruling, in part, to a “deliberately weak legal defense of DOMA” mounted by the Justice Department, in light of the Obama administration’s position favoring repeal of the law.

For Obama, the seeming disconnect between his policy goal and the actions of his Justice Department makes for uncomfortable politics.

During the presidential campaign, Obama promised action on a list of items gay-rights advocates have long wanted, but they have found him slow to act as president. The “don’t ask, don’t tell” military policy that bars openly gay people from serving appears to be on the path to repeal, but efforts to repeal DOMA have languished.

Related:

Gay marriage ban unconstitutional, rules federal judge in Boston

Obama 'supports repeal' of same-sex marriage ban, lawyers say

Pentagon eases 'don't ask, don't tell' law