A Wal-Mart Stores Inc employee sued the retailer on Tuesday, July 14, saying its prior policy of denying health insurance to the spouses of gay employees violated gender discrimination laws. The lawsuit, filed in US District Court in Boston, seeks nationwide class-action status.

Wal-Mart, the largest private US employer, began offering health insurance benefits to same-sex spouses last year, after the US Supreme Court in 2013 struck down part of the Defense of Marriage Act that denied federal benefits to married gay couples. Even after that change, the lawsuit says, Wal-Mart workers still live with the uncertainty of losing spousal coverage.

“Benefits provided by Wal-Mart as a matter of grace, are not secure and could potentially be withdrawn just when large health care costs are incurred,” the lawsuit says.

Jackie Cote, who has worked at Walmart stores in Maine and Massachusetts since 1999, said in the lawsuit that her wife, Diana Smithson, developed cancer in 2012 and the denial of insurance led to more than $150,000 in medical debt.

Cote and Smithson were married in Massachusetts in 2004, days after a court ruling made the state the first to allow gay nuptials. Smithson worked for Wal-Mart until 2008, when she left to care for Cote’s elderly mother, according to the lawsuit. The company then repeatedly denied requests by Cote to add her wife to her insurance policy. Smithson is now in hospice care, Cote said.

Last year, Cote filed a complaint with the US Equal Employment Opportunity Commission, a prerequisite to filing an employment discrimination lawsuit. The commission said in January that Wal-Mart violated gender discrimination laws by denying benefits to Smithson.

The commission in recent years has pioneered the argument that employment discrimination against gay people is a form of gender discrimination, since it would not happen if an employee were of the opposite sex, but it has not been vetted by courts.

In Cote’s case, for example, the commission said if her spouse were a man or her wife were married to a man, the couple would have received insurance. Wal-Mart argued before the commission that federal anti-discrimination laws did not apply to gay employees, so it was not obligated to provide benefits to their spouses.

But the retailer’s primary claim was that because it is self-insured, like many large companies, federal laws governing the administration of employee benefits preempted any discrimination claims. Companies insured by a third party, by contrast, would be subject to state insurance regulations prohibiting discrimination.

Allison Wright, a lawyer with Gay & Lesbian Advocates & Defenders, which filed Cote’s lawsuit, said the group believed other large companies have similar policies in place that could be open to legal challenges.

A Wal-Mart spokesman said in a statement that the company’s benefits coverage before the 2014 change was legal. He declined to comment further, saying the company had not yet seen the details of the lawsuit.

The lawsuit seeks to certify a class of current and former gay Wal-Mart workers who were married before Jan. 1, 2014, and various damages for employees, including the value of benefits that were denied and any out-of-pocket medical expenses.

The Supreme Court last month said the U.S. Constitution provided same-sex couples the right to marry, making their marriages legal in all 50 states. The case is Cote v. Wal-Mart Stores Inc, U.S. District Court for the District of Massachusetts, case number 15-cv-12945.