The City of Falls Church has agreed to sell its water utility to a Fairfax County-controlled authority for $40 million in a tentative deal that appears to conclude one of Northern Virginia’s most persistent water wars, the parties said Tuesday.

The federally mediated agreement promises to bring relief to hundreds of thousands of customers who have complained for years that the drinking water they received from the city’s utility cost nearly 60 percent more than the water their neighbors received from the county. Falls Church was charging a typical customer $62.13 per quarter, while Fairfax was charging $38.76

The deal — announced jointly by Fairfax County, Falls Church and Fairfax Water — calls for the city’s shouldering of $30 million in the city utility’s pension and debt obligations, a reduction in rates for all customers in the Falls Church system’s service area within two years, and an end to pending litigation between the parties. Fairfax Water would also retain the city utility’s current employees.

Fairfax County Board of Supervisors Chairman Sharon S. Bulova (D), Falls Church Mayor Nader Baroukh and Fairfax Water Chairman Philip Allin hailed the agreement as a triumph of neighborly collaboration that will benefit 140,000 customers.

“The City of Falls Church is proud of its longstanding commitment to regional cooperation,” Baroukh said in the joint statement. “The potential sale of the water system is a testament to that ideal and in the best interests of its water customers, taxpayers and utility employees.”

Under the agreement, the city would convey to Fairfax Water three undeveloped land parcels belonging to the city’s water utility; those parcels, which measure about nine acres, are in Fairfax County.

The county, meanwhile, will adjust its boundaries so that 42 acres of city-owned land containing George Mason High School, Mary Ellen Henderson Middle School and athletic facilities — along with eight other city-owned parcels in Fairfax County — will be moved inside city limits. That would give the city more control over the use of those properties, although the agreement also requires that most of the school property must continue to be used for education-related purposes for 50 years.

The deal — which was reached in principle Nov. 8 and brokered by Magistrate Judge Theresa Buchanan — has been approved by the Falls Church City Council, the Fairfax County Board of Supervisors and Fairfax Water’s board, whose members are appointed by the county.

It must still be approved by Falls Church voters in a November 2013 referendum. The agreement is also conditioned on the parties’ performance of due diligence, as well as the execution of a final written agreement.

Fairfax Water’s board approved the deal Thursday, followed by Falls Church’s City Council on Monday and Fairfax County supervisors on Tuesday. The litigation between the parties has been stayed while the parties work out the final details.