The dark clouds rolled in over Phoenix's Ahwatukee Lakes Golf Course in 2013, when its owner declared that the costs of keeping it open had outstripped what he was ­collecting in green fees.

Wilson Gee, a California businessman, shuttered the golf course, erected barbed-wire fences, and began looking for a buyer, telling reporters the land would never be a working golf course again. Homeowners, complaining he was turning the course into an eyesore in order to win approval to redevelop it into single-family homes, sued to reopen it. Gee shanked his first attempt to sell it in 2014, when one homebuilder walked away from a deal, but last year found a buyer in a Denver-based developer.

Then one night in February, the dark clouds turned to smoke, and a fire caved in the ­clubhouse roof.

It's a local story, defined by conditions peculiar to Ahwatukee, a community of about 80,000 separated from downtown Phoenix by a collection of 2,500-foot peaks known as South Mountain. But the dynamics that bred the deadlock between the struggling golf course's owner and its aggrieved neighbors are mirrored in communities across the country.

More than 800 golf courses have closed nationwide in the last decade, as operators grapple with declining interest in the sport and a glut of competition. Many of those shuttered courses were built on land proscribed from redevelopment by local zoning codes seeking to preserve open space — or, as with Ahwatukee, by deed restrictions intended to protect homeowners who had paid a ­premium to live near a golf course.

That leaves some golf course owners with the real estate equivalent of an unplayable lie: They can't make money running the course, and they can't recoup their investment by selling it.

"If you open a restaurant in a strip mall and you fail, you close shop and move on," said Jay Karen, chief executive of the National Golf Course Owners Association. But for golf course owners, it's much harder to pull the plug on a failing business; as courses fall into disuse, they become suburban zombies — not quite dead, yet far from alive.

"Nobody's tracking what's happening to the land," Karen said.

In April, fire ripped through the clubhouse at a shuttered western Kentucky golf course that had been the center of a lawsuit, burning through the afternoon until the roof collapsed over smoldering beams. On New Year's Day, a former volunteer firefighter lit a small fire outside the vacant clubhouse of a closed 9-hole course outside Orlando, then returned three days later to spark a larger blaze, with the help of a can of paint thinner he had found there. And in September 2015, a fire reduced the 10,000-square-foot clubhouse at an abandoned golf course in Bakersfield, Calif., to only a few charred beams.

To some extent, all those course closures are simply a market correction: The golf industry went through a building boom in the 1990s and early 2000s, driven by developers who used golf courses as amenities to help sell homes.

But the closures also reflect changing ­preferences for leisure activities. Participation in the sport is down 20 percent since 2003, according to data from the National Golf Foundation, and homebuilders have moved on to new types of recreational ­amenities, including man-made lakes and agricultural communities. Lately, the equipment business has been feeling the sting, with Nike Inc. announcing that it will stop making golf clubs and retailer Golfsmith International Holdings Inc. considering bankruptcy.

In the face of declining interest and competition driven by oversupply, course owners have gone searching for ways out. Some have donated golf course land to nature trusts and local parks, taking a tax break in return for preserving the open space. Others have inked deals with homebuilders — though those deals are often contingent on winning approval from homeowner associations or local governments.

"I'm hard-pressed to think of many cases where there isn't a higher or better use than a golf course for the site," said Jeff Woolson, managing director of the golf and resort group at CBRE Group. "The only clear exception would be Augusta, Ga." — the hallowed, Bobby Jones-designed course that hosts the Masters tournament each year.