Massachusetts has filed a lawsuit that argues the Defence of Marriage Act violates the US constitution by interfering with the right of states to define the marriage status of their own residents.

It was the first US state to legalise gay marriage in 2004 and is now the first to challenge the controversial Act.

The Defence of Marriage Act bans the federal government from treating same-sex relationships as marriages regardless of whether they are performed or recognised by a state.

The suit, filed by state Attorney General Martha Coakley in the US district court in Boston, also states the 1996 Act forces states to discriminate against gay married couples regarding various benefits rights.

It reads: “Congress overstepped its authority, undermined states’ efforts to recognise marriages between same-sex couples, and codified an animus towards gay and lesbian people.”

Speaking yesterday afternoon, Croakley said: “Massachusetts has a single category of married persons, and we view all married persons equally and identically.

“DOMA divides that category into two distinct and unequal classes of marriage.”

If states do not comply with the Act, they risk losing funding. Massachuetts has been told by the federal government it cannot afford to extend the state’s Medicaid programme for the poor to gay spouses.

It will also lose its Veterans Affairs funding if it buries the same-sex spouse of a veteran in a cemetery.

President Barack Obama promised to repeal the Defence of Marriage Act in his election campaign, calling it “abhorrent”.

Charles Miller, a spokesman for the Justice Department, said yesterday that the president “supports legislative repeal of the Defence of Marriage Act because it prevents LGBT couples from being granted equal rights and benefits.”

He added that the case would be reviewed.