Talks to settle thousands of lawsuits over flood-insurance claims from superstorm Sandy have all but stalled after officials in Washington concluded that federal law bars them from paying homeowners' legal fees, according to people familiar with the negotiations.

The ruling over attorneys' fees is a setback for roughly 2,000 homeowners in New York and New Jersey who are awaiting settlements from the National Flood Insurance Program and may now owe their lawyers as much as a third of anything they receive.

The talks, however, are ongoing. Lawyers for homeowners and officials at the Federal Emergency Management Agency, which runs the flood insurance program, say they are optimistic about reaching a deal.

Homeowners filed the suits after the 2012 storm, saying they were underpaid on their flood-insurance claims. After months of fighting in court, FEMA initiated settlement talks in February after a federal judge concluded documents had been forged to deny some claims.

The allegations have led to a criminal probe by the New York attorney general's office. The inquiry expanded last month as state investigators began working with the U.S. Department of Homeland Security's Office of Inspector General, a law enforcement official said.

The settlement talks, meanwhile, have led to tentative deals to resolve roughly 650 cases. But no homeowners have signed off on the settlements. And no checks have been issued.

The question of whether the government could pay homeowners' legal fees has hung over the talks from the beginning. When storm victims filed lawsuits, most signed contracts to pay one-third of any settlement to their lawyers.

Get the Biz Briefing newsletter!

After fraud allegations surfaced, FEMA negotiators and lawyers for homeowners discussed whether the government could cover legal fees. The attorneys, who agreed to accept a quarter of any settlements rather than a third if the government paid, argued that defrauded homeowners shouldn't have to foot their own legal bills.

"The reason these people are in the situation they are in is because of the federal government," said J. Steve Mostyn, a lawyer negotiating on behalf of homeowners.

Yet that deal was scuttled last week, after lawyers for the Department of Homeland Security, which oversees FEMA, concluded it was prohibited under federal law.

Over the past five days, FEMA negotiators and lawyers for homeowners have been locked in talks to restructure the settlements, looking for a way to cover legal fees.

Those negotiations are also focusing on whether homeowners who received grants from the state's storm recovery program, New York Rising, will have to return that money if they accept larger flood insurance settlements.

"We've hit a couple of snags," said Denis G. Kelly, a Long Beach attorney involved in the negotiations. "But I'm optimistic that . . . we are going to get through these issues."