Just below the lime, mango and avocado orchards that have sustained life in Tambogrande for generations lies a thick deposit of valuable metal. Gold and silver sit on top, copper and zinc underneath. The deposit could be worth $1 billion to the Canadian mining company that has the rights to tap it.

Doing so, however, would require demolition of a crescent of homes bending down from the highest hilltop of Tambogrande, which is crowned with a peach-colored statue of Jesus. The open-pit mine would open up just blocks from the central square, replacing about a third of this comfortable town beside a slow river in Peru's arid north.

Although this is a place where most streets and houses are made of dirt, the 20,000 residents of Tambogrande have decided that they prefer their homes, their hillside and their fruit orchards to gold. In an unofficial referendum held here last Sunday, nine in 10 voters made known that the mining company, Manhattan Minerals, was not welcome.

Despite that message, the company intends to proceed. In doing so, it has embarked on a confrontation that involves such enduring national themes as gold and greed, murder and foreign interests -- and even ceviche, the seafood delicacy that is Peru's most celebrated contribution to Latin American cuisine.

The confrontation has brought the debate over global capitalism to this dusty corner of Peru. A flock of international nonprofit organizations have arrived to advise townspeople in their fight, precipitating a war between a foreign mining company and a foreign anti-globalization movement, with Tambogrande in between.

Towns like this one have rarely been allowed to harness their own wealth. The eventual result here in the fertile San Lorenzo Valley may be a mine that sends most of its profits abroad and the remainder to the government in Lima, 540 miles to the south. But the residents of Tambogrande have resolved to prevent that. They are counting on a tentative democratic revival underway in Peru after a decade of quasi-dictatorship, hoping that a clear expression of their will can counter the promise of contracts and cash.

"If they don't respect these results, we will have to rely on the power that comes from the whole world knowing that these are our wishes," said Hugo Abramonte Ato, a retired schoolteacher born 55 years ago to landless peasants. "We don't want to change our life in exchange for this supposed bonanza."

The referendum was the first of its kind in a country that has known only 15 consecutive years of democracy in the past century. It followed months of debate characterized at times by the type of violence traditionally used to solve problems in this part of the world.

A leader of the anti-mine movement, Godofredo Garcia, was killed in his lime grove last year by two hooded men, a month after a mob torched the first section of "model homes" that Manhattan Minerals planned to give to 1,600 families displaced by the first phase of its project. The Vancouver-based company, with its sole interests in Peru, saw $16 million in property burn.

Underlying the debate is Peru's dark, unfinished legacy of struggle over property rights for the rural poor. Many of these farmers are first-generation landowners, the sons and daughters of parents who worked as indentured servants on the valley's vast haciendas. They became the first beneficiaries of Peru's grand experiment in land reform three decades ago. Now that the haciendas are gone, many of these peasants' children view the foreign mining company as a new enemy in the same struggle.

Manhattan cannot proceed without buying the houses at the site of the proposed mine. It will likely sweeten its offer to the town to persuade the owners to sell.

The negotiations are also a test for President Alejandro Toledo, who took office less than a year ago after pledging to turn the page on corruption and energize Peru's underdeveloped agricultural sector.

His predecessor, Alberto Fujimori, fled to Japan and faces charges in Peru ranging from corruption to murder. If Toledo backs Tambogrande, it would mean nullifying a Fujimori-era contract and risk spooking foreign investors at a time when exploiting gold deposits has become a linchpin of national economic development policy.

Peru is the world's eighth-largest gold producer -- the largest in Latin America -- while a decade ago it did not appear on the list at all. Gold accounts for a third of Peru's export revenue, and only 10 percent of the country has been explored.

"This is part of an anti-development campaign that is going to be unfolding across Latin America, and I think it needs to be understood in that way," said Lawrence M. Glaser, chairman and chief executive of Manhattan Minerals, who called the referendum a ploy by anti-globalization activists to undermine the project.

The company has had the concession here for five years. Along with guaranteeing new homes for displaced families, the company has promised that 300 mining jobs will be filled by town residents and predicts that another 1,500 spinoff jobs will be generated by the project. The company plans to invest $350 million in the operation, and estimates a billion-dollar profit over the life of the project.

In a phone interview, Glaser said the fact that the referendum was held three weeks before the scheduled release of a company-funded environmental study "should be seen for what it is, a public relations campaign." Before it was held, the vote was deemed illegal by Peru's minister of energy and mines, Jaime Quijandria, one of the government officials who have refused to comment on the project until the environmental study is released.

"There has been almost no investment in the agricultural sector in this area since land reform, and we don't see the foreign [nongovernmental organizations] that are opposing this project offering any development alternatives," Glaser said.

Almost a century and a half ago, German scientist Ernest Wilhem Middendorff got off the boat in the nearby port town of Paita, made his way to Tambogrande, and discovered gold. In those days, mining gold from the Piura River was a low-tech, low-bother operation. Most residents saw a greater potential for riches in the fruit trees that sprouted from the dry soil.

A century later, starting in the late 1940s, an irrigation system financed largely by the World Bank turned 150,000 desert acres of the San Lorenzo Valley into some of Peru's richest farmland. The large hacienda owners reaped the early benefits, their cotton plantations flourishing under the care of peasants. That system persisted until the early 1970s when land reform turned peasants into landowners for the first time. Today, the valley's hundreds of small and medium-size plots account for $100 million a year in agricultural production.

The region produces 25,000 tons of mangoes each year, many bound for the United States, and almost half of the limes that Peruvians use to make ceviche, a savory, spicy cocktail of raw seafood seared by lime juice. That fact has been exploited by shrewd anti-mining activists, who have popped up on Lima's busiest streets wearing fluorescent lime costumes and chanting the slogan: "Without lime, there is no ceviche."

What farmers fear most is that a mining operation would consume farmland, contaminate their fruit and siphon off too much water, forcing them into mining jobs they known nothing about. Manhattan is one of 10 mining companies with concessions in and around Tambogrande, and residents fear it is the Trojan horse for an industry with designs on the whole valley.

In the past year, two chapters of Oxfam International have joined the town's cause. Oxfam America has spent an estimated $20,000 on the community, including commissioning a study last year that predicted dire environmental consequences if the mine opens. The Environmental Mining Council of British Columbia and the Washington-based Mineral Policy Center, two groups opposed to mining, helped underwrite the study.

In addition, Oxfam America has contributed $4,000 to the Defense Front of Tambogrande, a local group formed to fight the mine, to help defray legal costs for several people facing charges for destroying Manhattan's property last year. Cathy Ross, a program officer for Oxfam America in Lima, said the group has not taken sides in the debate but is only helping Tambogrande determine its own future.

"There are few cases as clear-cut as this one," Ross said. "There's a lot at stake for the company, a lot at stake for the government. And from their perspective, those look a lot more important than what's at stake for the local community."

It is perhaps Manhattan's bad luck that, on the surface at least, Tambogrande doesn't want for much. All 8,000 people living in the urban center have running water and electricity. While not generating the opportunities it might with more technology, agriculture has meant that the town is fully employed.

"Why would I want a new house?" asked Alejandro Silupu Riofrio, 35, a shop owner whose home has crumbling mud walls. "We're fine with this one."

Those resources make Tambogrande different from Peru's other mining zones, usually distant, desolate mountain regions where towns, if they exist at all, have nothing. But several reports, including a second study financed by Oxfam America, suggest that surrounding communities hardly benefit from mines.

While local jobs are created, they do not last forever and most of the revenue is sent elsewhere, the reports have found. Last year, for example, the Denver-based Newmont Mining Corp. paid $50 million in taxes to the government from its gold mine near Cajamarca, 450 miles north of Lima, the most profitable gold mine in the world. The city received $800,000 of that and is resisting the mine's expansion plans.

In the past year, scores of Tambogrande residents have heard this message in workshops organized by Oxfam Great Britain. Many now worry that the mine would transform a place where the Saturday evening gathering of Christian evangelists has been the most popular form of mass entertainment in a honky-tonk town with a disco on every street corner.

"In mining zones, poverty is the highest and prostitution the greatest," said Eligio Villegas Salvador, an evangelical Christian, recounting what he has picked up in the workshops. "So we say no thank you."