President Trump has sought to help farmers by rolling back the Obama administration’s hotly contested Waters of the United States rule, but it didn’t happen soon enough to help John Duarte.

The farmer from California’s Central Valley agreed Tuesday to a settlement with the Justice Department that will have him pay $330,000 in civil penalties and purchase $770,000 in vernal pool mitigation credits for violating the water rule by plowing his wheat field in 2012.

The alternative was to roll the dice in court and risk a fine of as much as $45 million, which would have devastated his family business, Duarte Nursery, located near Modesto.

“This has been a difficult decision for me, my family, and the entire company, and we have come to it reluctantly,” said Mr. Duarte in a statement. “But given the risks posed by further trial on the government’s request for up to $45 million in penalties, and the catastrophic impact that any significant fraction of that would have on our business, our hundreds of employees, our customers and suppliers, and all the members of my family, this was the best action I could take to protect those for whom I am responsible.”

The agreement brings to a close the long-running case that became a rallying cry in rural America against what critics have decried as the Clean Water Act’s regulatory overreach.

Mr. Duarte bought the 450-acre plot in Tehama County to grow wheat, but the Army Corps of Engineers ruled in 2013 that the pools running alongside the furrows were navigable waters under the Waters of the U.S., codified by the Obama administration in 2015.

The Corps. said he should have obtained a permit first and accused him of “ripping” federally protected wetlands. Mr. Duarte sued the Corps., but a federal judge ruled against him in June 2016.

Under the consent decree, Mr. Duarte admitted no liability but must “smooth all disturbed soil surfaces and reasonably match the pre-November 2012 grade and hydrology within impacted waters of the United States on the site,” which is about 22 acres.

In a statement, the Justice Department said that the decree “allows Duarte to return the vast majority of the site to productive use and allows him to seek future determinations concerning jurisdictional waters at the site.”

“Today’s agreement affirms the Department of Justice’s commitment to the rule of law, results in meaningful environmental restoration, and brings to an end protracted litigation,” said Jeffrey Wood, acting assistant attorney general.

Tony Francois, senior attorney for the Pacific Legal Institute, which has represented Mr. Duarte free of charge, said the fourth-generation farmer would have preferred to appeal the ruling, “which holds that plowing a field requires federal permission — despite the clear text of the Clean Water Act and regulations to the contrary.”

The penalty phase of the trial had been scheduled to begin Tuesday in U.S. District Court in Sacramento.

“John and his counsel remain concerned that legal liability for farming without federal permission undermines the clear protections that the Clean Water Act affords to farming and poses a significant ongoing threat to farmers across the nation,” said Mr. Francois.

Mr. Trump has made upending the Waters of the U.S. rule one of his top priorities, signing an executive order directing the Environmental Protection Agency to douse the regulation, calling it a “massive power grab.”

“The Clean Water Act says that the EPA can regulate ‘navigable waters,’ meaning waters that truly affect interstate commerce,” Mr. Trump said at the Feb. 28 signing. “But a few years ago, the EPA decided that ‘navigable waters’ can mean nearly every puddle or every ditch on a farmer’s land, or anyplace else that they decide, right?”

In July, EPA administrator Scott Pruitt began the process of formally rescinding the 2015 rule by publishing the proposed changes in the Federal Register.

“Mr. Duarte’s case clearly highlights the need to keep the federal government out of America’s backyards, fields and ditches,” said House Agriculture Committee Chairman Michael Conaway, who signed the letter with House Judiciary Committee Chairman Bob Goodlatte.

“Little by little we watched the previous administration chip away at the rights of land and property owners, aiming to expand its authority through broad new rules under WOTUS, all while providing little clarity to farmers and ranchers about what qualifies for exemptions,” Mr. Conaway said.