In Missoula, Montana, where towering mountains abut a youthful college town, A River Runs Through It is something of a sacred text. The Norman Maclean novella is a semiautobiographical account of a Presbyterian family praying and fly-fishing their way through the early 20th century in the still-wild West. You can hardly talk about this place without someone mentioning the story, made famous by Robert Redford’s film adaptation. And for good reason—the tale is witty and tragic, and it evokes all that is lovely about small-town life amid trout-thick rivers and forests full of wildlife. Maclean ends his work with this image:

Eventually, all things merge into one, and a river runs through it. The river was cut by the world’s great flood and runs over rocks from the basement of time…. Under the rocks are the words, and some of the words are theirs. I am haunted by waters.

It’s a poetic conclusion, but, the fact is, you won’t find words underneath the rivers and rocks here. Instead, you’ll find a rich aquifer filled with fresh snowmelt and rainfall that supplies drinking water to more than 50,000 people. For more than a hundred years, the utility that pumps and distributes that water to the city’s citizens has been held in private ownership, passing every so often from one set of profit-seeking investors to the next—until now.

On June 22, Missoula’s leaders officially took possession of Mountain Water Company, ending a long campaign to control their community’s most important resource. That campaign began in 2014, when Missoula and its long-time mayor, John Engen, believing that water distribution and management should be in the hands of the people, launched a determined legal battle to win control of the city’s local utility. It was a risky gambit, fraught with political and financial peril: Missoula’s foe was one of Wall Street’s wealthiest private-equity firms, the Carlyle Group, which owned the water utility. The fight that followed was fierce, a conflict of attrition featuring allegations of fraud and duplicitous dealing. Its outcome, however, offers lessons to other communities across the country, and especially in the arid American West, that want to defend their future by controlling their most cherished resource.

There aren’t many feel-good tales that pit a small city against a financial giant, but this is one of them.

Everyone was surprised when the Carlyle Group came to town. “Surprise, shock, all of that,” says Karen Knudsen, the executive director of the Clark Fork Coalition, a leading water-conservation organization in the region. “Nobody saw it coming.”

It started when Robert Dove, the managing director of Carlyle’s infrastructure fund, came to western Montana to meet the mayor in December 2010. Engen, a big man with a goatee who favors plaid shirts and fleece vests, says he welcomed the East Coast executive into his corner office at City Hall.

“He was coming to tell me Carlyle was buying the water system,” Engen says. “It was, in effect, a fait accompli, and it was completely unexpected.”

Dove, Engen says, told him that Carlyle had negotiated the acquisition of Mountain Water, along with two sister utilities in California, from their previous owner for $102 million. The purchase would come with 74 water rights, including rights to pristine Rattlesnake Creek, which flows from mountain wilderness in the north. Though Montana’s constitution forbids private entities from owning water, such rights allow for privileged access to the resource. They create a caste system of sorts, built on liquid, with holders of older rights having first dibs on water use. They are the true treasures of economic life in this dry land.

“Water,” said the great Western historian Bernard DeVoto, …is incomparably more important than all other natural resources in the West put together.” Climate change, population growth, and economic turmoil have only heightened the stakes, and so there is a movement afoot to commoditize and profit from this life-giving compound. Witness Wall Street firms, like Water Asset Management, buying up water rights across the West. Witness also the story of Weed, California, where a large timber company plans to privatize the small town’s water source. Witness Carlyle’s move into Missoula.

But first: To proceed with the Mountain Water purchase—a controversial one given the firm’s image as a juggernaut of eastern finance—Carlyle needed permission from Montana’s Public Service Commission, an elected body that regulates various utilities in the state. The commission, in turn, was more likely to support the proposal if Missoula’s elected officials backed the deal. So Carlyle asked Engen for his support. The mayor, sensing that new ownership might provide an opening to negotiate an eventual public takeover, offered an endorsement. But he had conditions.

Most of all, Engen wanted assurances that Carlyle would entertain in good faith future offers from the city to purchase Mountain Water. He wanted Missoula to be first in line should Carlyle ever seek to sell the utility.

The Clark Fork Coalition was also involved in negotiations. It asked Carlyle to make two more promises: It wanted the corporation’s word that it would not draw water from Rattlesnake Creek unless an emergency warranted it. More important, the coalition wanted Carlyle to commit to keeping Missoula’s water within the local watershed.

The Coalition was afraid that Missoula’s aquifer might someday be used for commercial bottling operations, Knudsen explained. It didn’t want arid western Montana, with its scant rainfall, to suffer the same fate as drought-plagued California, where brand name bottled-water suppliers regularly siphon water out of the state at a profit.

In the end, Carlyle agreed to all conditions, and in 2011 it signed a legally binding letter to that effect. The letter compelled Carlyle, should it seek to sell the water utility, to “consider in good faith any offer from the City to purchase Mountain Water, the Missoula water system, each in its entirety or the stock in Mountain Water at any time.”

In the coming years, the corporation would honor two of its three promises. When it came time to entertain the city’s bids for Mountain Water, however, Engen says the big wigs at Carlyle betrayed him.

“Robert Dove told me he was going to sell me a water company,” he says, sitting in the very same office where he first met the Carlyle manager years earlier, “and then he didn’t.”

For many years, Missoula was the only large municipality in the state of Montana that did not own its own water system. And the college town wasn’t just an anomaly in Big Sky Country—elsewhere, too, private, for-profit water provision is relatively rare. Public entities, in fact, do the large majority of this country’s water distribution, a legacy of civic reformers who saw socialistic infrastructure as the proper custodian of life’s vital resources.

At the turn of the 20th century, the progressive movement and others like it, responding to cholera outbreaks, urban fires, and other health crises, called for the creation, consolidation, or acquisition of public water systems across the nation. From Seattle to New York City, people wanted democratic control of local resources. The “sewer socialists” of Milwaukee, Wisconsin, who ran city government in the early 1900s, are emblematic of the era’s public-spirited ethos.

“Such activities as are now most dear to us are common property,” wrote Daniel P. Hoan, a leading socialist who served as Milwaukee’s mayor from 1916 to 1940, in his book The Failure of Regulation. “The parks, the schools, the roads, the museums and libraries. These are now operated for public use, comfort and convenience, not for private welfare, gain and profit.”

Water provision, too, was a natural candidate for common property, and so the United States today boasts roughly 25,000 publicly owned water systems. These systems provide the essential resource to more than 80 percent of the population. They are, even now, in this post-recession age of cash-strapped governments, a robust bastion of the public sphere.

But the systems face a reckoning, too. In 2013, the EPA estimated that this country’s drinking water utilities will require nearly $400 billion for repairs, upgrades, and infrastructure investment in the next two decades. At the same time, federal support for such utilities has continued a 40-year decline in real dollars from its peak in the late 1970s and early 1980s. The contamination catastrophe in Flint is a partial result of these many decades of disinvestment.

But while local utilities struggle, private investors see opportunity. As Diane VanDe Hei, the chief executive officer of the Association of Metropolitan Water Agencies, told the Pew Charitable Trusts in a 2016 report: “There’s a desire to bring more private capital into the water world. Money is needed for aging infrastructure, for treatment plants, for pipes. The more money you can make available, the more you can do.”

In some places, privatization is already occurring at a steady clip, especially in Eastern states like Pennsylvania and New Jersey. There, legislators, public-utility commissions, and private water providers have come together in recent years to pass “fair value” laws that make privatization easier. The laws roll back restrictions on the kinds of costs that water utilities can pass on to rate payers, thereby incentivizing the sale of public property.

In New Jersey, moreover, Governor Chris Christie passed a law in 2015 that facilitates the privatization of water systems in cities under state-run emergency management. Despite vociferous opposition, Christie is now considering using the law to sell Atlantic City’s water infrastructure to private interests.

In today’s tumultuous global economy, investors of all sorts, from public companies to pension funds, have a huge interest in such infrastructure, says Michael Deane, executive director of the National Association of Water Companies, a private water industry trade group. “For well-run infrastructure, particularly utilities like gas or water or electric, where there is a good cash flow, it is pretty stable,” he says. “People pay their bills and will pay them forever and you know that money is coming in.”

It’s no surprise, then, that Carlyle came to Missoula. The water system was a safe bet and, given its relatively large size, a rare opportunity. Missoula, however, with its scrappy mayor and determined lawyers, undoubtedly surprised Carlyle.

Carlyle took control of Mountain Water shortly after obtaining Public Service Commission approval in late 2011. During the following year, the mayor set about garnering public support, hiring consultants, and preparing to purchase the water utility. During that time, according to allegations in a “bad faith” lawsuit the city filed in 2015 against the firm, Robert Dove continually assured Engen that he intended to sell Mountain Water to Missoula, even asking the mayor at a dinner meeting in Washington, DC, “Are you ready to own a water system?”

The big day finally came in February 2013 when, after consulting with Carlyle on appropriate valuation, the city made a $65 million offer for the utility.

Carlyle’s reply came quickly: No. It was a flat denial, Engen says, without any kind of credible counter proposal or willingness to negotiate in good faith, as per the 2011 letter agreement. Engen was stunned.

“It became apparent that Carlyle and other Defendants had no intention of entertaining in good faith any offer from the City for Mountain Water,” the city’s attorneys allege in the “bad faith” lawsuit, “and that it also had no intention of ever dealing with the City in good faith to facilitate the City’s acquisition of Missoula’s Water System.”

Nevertheless, Missoula tried to negotiate for the water system, asking Carlyle to name a price it would be willing to accept, according to Engen. But the firm rebuffed the city—arguing variously that the system was not for sale as a free-standing entity and that the offering price was insufficient, a claim the company reiterated in a comment to The Nation.

“The 2011 agreement between [Missoula] and [Carlyle] guaranteed that the City’s offers to purchase Mountain Water Company would be considered in good faith,” asserts Carlyle Managing Director Christopher Ullman in a written statement. “It did not give the City the right to buy Mountain Water Company at whatever price it wanted to pay. [Carlyle] upheld its end of the bargain, considering the City’s offers in good faith, but could not sell Mountain Water Company for far less than it was worth.”

The mayor was mad. John Engen had supported Carlyle’s ownership bid at considerable risk: After all, his constituents might look askance at a faraway corporation’s gaining control over their pipes and taps and purification plants. He had supported the bid because it was a stepping stone, albeit a slippery one, that could lead to public ownership.

Now, in his outrage, he turned to the only tool he had left: the law. In April 2014, after gaining approval from the city council, he announced that Missoula would use Montana’s eminent-domain law to turn Mountain Water into a public institution. The mayor took Carlyle to court.

“We had a hill to climb, and I looked at the hill and the question was: Do we take a risk, a calculated, thoughtful risk and climb that hill for the benefit of people I serve?” Engen says. “Or do we take the easy wrong?”

Engen’s pursuit of Mountain Water stemmed from the simple belief that, as a matter of social and economic justice, the people are the proper guardians of essential resources. Strong arguments support his civic-minded stance.

“Say you are a local resident and don’t want Nestlé coming in to bottle tap water in your town,” says Mary Grant, a public-water campaigner at the nonprofit Food & Water Watch. “If you have local ownership of the water system, then you have influence to stop the deal. But if it is privately owned, then you don’t have a voice in the process.” Publicly owned utilities, in other words, are directly accountable to voters.

Grant adds that public systems are generally more affordable, as well. In a report released in February 2016, her organization surveyed the 500 largest water systems in the United States and found that, on average, “private, for-profit utilities charged typical households 59 percent more than local governments charged for drinking water service.”

Michael Deane of the National Association of Water Companies says such arguments miss the point.

“Much of what you hear about private-sector participation is false and misleading…,” he says. “If you look at things like rates, they say that the private sector costs more. But it is a false argument to make: The easiest way to make water rates low is to let your system fall apart.” Profit, he adds, might sound bad, but it encourages investors to let small or struggling water systems access their capital.

These divergent views—one which emphasizes the social and political importance of public ownership, the other which proclaims the efficiency and necessity of private investment—are at the heart of Missoula’s water brawl.

The opponents finally met in state court in March 2015 for a three-week bench trial. Under Montana’s eminent-domain laws, Missoula had to prove that public ownership of the water utility was “more necessary” than private ownership. The city sought to do so by contrasting its motivations with those of Wall Street. “Whereas Carlyle Infrastructure is motivated to send profits out of state to benefit their owners and shareholders,” asserted the city’s lawyers in a court filing, “the City of Missoula is motivated to maintain and build a better water system for the people of Missoula.”

That argument convinced the judge and, in June 2015, Missoula got permission to proceed with condemnation. Not surprisingly, Carlyle appealed.

And then it did something downright outrageous. Before the appeal could be heard, Missoula’s local paper hit the streets with stunning news: Carlyle had sold Mountain Water, along with its California sister utilities, to a subsidiary of a little-known Canadian company for more than $300 million. And, with imperious disregard for precedent, it had done so without permission from the Public Service Commission.

“We were truly blindsided by the sale,” said the Public Service Commission’s chairman at the time. He called the action a “frontal assault on our constitutional and legislative authority to regulate the utilities.” The PSC later fined the new owner, but there was no real way to roll it back. Mountain Water was in Canadian hands now, and Carlyle had slipped away from the whole imbroglio with a tidy profit.

In the end, though, the shenanigans didn’t alter the result. Carlyle still pursued its appeal, and the state’s highest court still had its say.

After weighing the case for months, the Montana Supreme Court made its announcement on August 2, 2016, before a crowd of citizens, public officials, and Mountain Water workers. Perched behind a long table, the seven justices looked out on the crowd and affirmed the lower court’s ruling. In a 5-2 decision, it denied Carlyle’s appeal, and gave Missoula what it so desperately wanted. The city would soon be the owner of a water system, at a court-mandated price of $88.6 million, to be raised through municipal bonds and loans. After a fight far longer and costlier than Engen ever anticipated, the public had finally prevailed.

The movement for public ownership of water systems is strong in America. The socialization or “municipalization” of such infrastructure happens fairly regularly, keeping pace with and often eclipsing privatization efforts. What makes Missoula’s victory novel is the wealth and power of its opponent.

“It is a really good example of how cities can take back control of their water systems from corporate interests,” says Mary Grant at Food & Water Watch. “It is a really good story about a small community fighting Goliath and winning.” Other Davids in different states have taken notice too.

In Apple Valley, California, local officials, fed up with regular rate hikes, are trying to municipalize their local utility using eminent-domain laws against the same Canadian firm that bought Mountain Water last year. Leaders in Apple Valley and Missoula, in fact, shared strategies over the years as they both pursued their water systems in court.

“It was very heartening, especially in that the court saw that there is a greater good served by public ownership of such an important resource,” says Apple Valley spokeswoman Kathie Martin, of the Missoula victory. “It just supported the argument we have been making all along.”

Was it worth it? Was the long fight worth the $93 million price tag, including more than $8.5 million in combined legal fees? John Engen, sitting in the corner office where he conducted the asymmetrical campaign against Carlyle, certainly thinks so.

“What I hope is that, in 50 and 100 years, the citizens of Missoula will take for granted the fact that they own and operate a fine water system and that the stuff of life is delivered for the public, to the public, by the public,” he says. “This will matter long after nobody even knows that I existed.”