Rhode Island lawmakers and nursing homes said Tuesday afternoon they had reached a tentative deal that would allow for the dismissal of a $24 million court battle over Medicaid reimbursements.

Superior Court judge this spring found in favor of 59 nursing homes alleging the state made illegal cuts to their Medicaid funding. The facilities argued that the state for several years calculated their rates using a method that was intended to be used for only one year.

After the state failed to appeal, Rhode Island was on the hook for $24 million in retroactive payments over the next three years. But to undo the damage, House Speaker Nicholas Mattiello (D) presented a budget that would have slashed Medicaid funding by 8.5%.

Nursing home associations argued that cut could force some facilities to close.

Under a deal reported by the Associated Press on Tuesday, lawmakers will now give all nursing homes a 2.5% funding increase in two stages, starting July 1, in exchange for a move by the plaintiffs to dismiss the case.

“I believe it’s in everybody’s best interest,” Mattiello told WPRO on Tuesday while announcing the deal. “I think that they should have always addressed their concerns at the table, negotiated them and discussed it rather than running to court, so that was probably a mistake in the first place.”

Rhode Island Health Care Association President and CEO Virginia Burke called the settlement terms “fair” and predicted the nursing homes would accept the terms.