The state is challenging the constitutionality of the federal 1996 Defense of Marriage Act , saying the law denies " essential rights and protections " to same-sex couples who have married since Massachusetts became the first state in the nation to legalize gay weddings in 2004 .