Florida has worked out a deal to cap the amount of money that will be paid to law firms hired to help the state in its long-running water war with Georgia.

Some Republican legislators last year complained about the escalating costs—which began to rise sharply after the state took its case to the U.S. Supreme Court—and initially refused to sign off on any additional payments.

And then last fall, the Florida Legislature quietly signed off on a proposal paring back the cost owed to one of the law firms by about $4 million. Their action will bring the total spent since 2014 on fees and expenses to more than $57 million. That includes a final payment for the hearing held earlier this month before Supreme Court justices. The Associated Press started asking about the deal last December.

Florida Gov. Rick Scott defended the cost.

“Throughout this fight, Florida has been, and continues to be, absolutely committed to subjecting every expense to strict scrutiny so that we can make certain that tax dollars are being spent appropriately,” the Republican governor said in a statement.

“Let me be clear—this continued battle for equity in water use is critically important to so many communities, marine fisheries and families whose livelihoods depend on a fair system that ensures a healthy Apalachicola Bay. We will never stop fighting for Florida and the thousands of jobs and livelihoods at risk in Apalachicola Bay.”

Florida House Speaker Richard Corcoran, who said last year that the state was getting “gouged” by the law firms, did not respond to repeated requests for comment made by phone and email to his office.

The legal battle over water in the Apalachicola, Chattahoochee and Flint river basin has been going on for nearly three decades.

Florida finally sued Georgia in the Supreme Court in 2013, blaming farmers and the booming area around Atlanta for low river flows that harmed the environment and fisheries dependent on fresh water entering the area. Florida portrayed the case as its last chance to “stem Georgia's inequitable consumption” of water from the Chattahoochee and Flint rivers in Georgia, leaving too little by the time the rivers come together and pass into Florida. The AP reported last year that the state had spent $237 million on private lawyers from the time Scott took office in 2011 until early 2017.

Officials with the Florida Department of Environmental Protection have previously said they scrutinized invoices sent to them by the law firms involved in the water-wars litigation and that they had denied more than $3 million in legal expenses and hourly fees.

Lauren Engel, a spokeswoman for the department, said the agency was “proud of the action” taken to slice $4 million off the fee owed to the firm of Latham & Watkins. Latham & Watkins, a prestigious firm with offices around the world, was hired at the urging of Florida Attorney General Pam Bondi to help with the case before the Supreme Court.