Atacama is a fearsome, ugly desert in northern Chile, a vast territory devoid even of weeds and scattered with hundreds of ghost towns.

Ancient, abandoned smokestacks are almost all that's left of the boomtowns that sprang up in this desolate wilderness in the 1800s when miners migrated here to dig up Chile's white gold -- nitrate used in fertilizers, detergent and explosives.

British and Chilean mine owners built huge fortunes on nitrate before the industry collapsed in the 1920s when new, synthetic nitrates undermined the market and expensive desert mining towns became obsolete.

At first no one thought to preserve the dusty, homely towns after the last one shut down in 1979.

Equipment went on the auction block, looters scavenged the scrap and miners' bunkhouses faded into the desert.

But groups of nostalgic desert dwellers who grew up in the mining towns have pressured the government to restore some of the towns for tourists.

"There is nothing in the world compared to the nitrate era in Chile. We want to defend this heritage," said Julio Valdivia, 79, who moved with his family from mine to mine as the industry faded and is now supervisor at the restored Humberstone ghost town.

The government responded to their petitions in the 1990s and set up nonprofit groups to preserve Humberstone and Chacabuco, among the few nitrate towns with enough surviving buildings to be restored for tourists.

In July the effort got a boost when UNESCO, the U.N. cultural body, declared Humberstone, the most visited site, a World Heritage Site.

Humberstone is run on a skeletal budget of about $150,000 a year, which comes from entry fees, a yearly gift from modern nitrate mining company SQM, and occasional grants from the Chilean and foreign governments for specific projects to restore one building at a time and install a museum.

About 45,000 tourists a year drive an hour from Iquique port on the Pacific coast to visit Humberstone and tour the restored hotel, plaza, dry goods store, workers' housing, the disintegrated hulk of the processing plants and a rusted steel swimming pool.

Valdivia, the caretaker at Humberstone, is nostalgic about the hard life in the tight-knit communities where Bolivian, Chilean and Peruvian miners lived in simple row houses and British engineers enjoyed luxurious digs with imported pianos.

"I'm kind of proud of the rough life. . . . I remember kids had to go out to the nitrate fields to go to the bathroom because there weren't any toilets. I saw my mother carting two cans of water, 20 liters each. I saw her cook on the ground," he said.

Square riggers lined up at the world-famous ports of Iquique and Pisagua, loading more than 2.2 million tons a year of nitrate to fertilize Cape Town oranges, Calcutta tobacco, Turkish carrots and French wheat.

The ghost towns bear a boom-and-bust lesson for Chile, a mining economy riding high right now on record copper prices.

"Chile's history is intimately linked to the nitrate story. We lived off nitrate for many years. . . . It was a glorious past but it was also covered in blood," said Ana Benavides, 55, a nitrate-town child now helping with restoration efforts.

The nitrate fields lay in Peru and Bolivia until Chile seized the territory in an 1879-1884 war -- relations between the neighbors have been strained ever since -- and nitrate taxes were soon generating half the government's income.

Mining companies lured tens of thousands of workers from the green Chilean south to the desert, then paid them in scrip that had value only at the company store.

Deprived workers began to demand rights and the nitrate fields became the crucible of a movement that laid the foundations for Chile's modern labor laws.

Desert women have bittersweet memories of learning to make paper flowers for the graves of miners who died from black lung, since there were no real flowers in the desert.

"We ate dust all day, they had to explode to dig out the caliche [nitrate-bearing rock] and the big clouds of dust went over our houses where we lived. We all breathed it. It was normal to go around with white hair," Benavides said.

Chacabuco's centerpiece is the wooden theater on the town square. Famous opera stars toured the boom towns in their heyday, as did prostitutes carrying government health certificates.

Roberto Saldivar was a political prisoner at Chacabuco for six months when the Augusto Pinochet dictatorship used the abandoned mine as a prison camp. Saldivar later returned as a caretaker who lives on tips.

He says he returned to live in silence in the desert, but it is interrupted by ghosts: newborn babies crying in the ruined hospital and music wafting from the theater.

Humberstone is one the few nitrate towns with enough surviving buildings to be restored for tourists. It is run on a skeletal budget of about $150,000 a year.A man enters a building along a street in the abandoned Humberstone nitrate town, in Chile's Atacama desert.A cross stands in the town of Humberstone, now designated a U.N. World Heritage site.