Since Francisco Pizarro's conquistadors first clanked into their domain almost 500 years ago, Bolivia's indigenous people have been subjugated and marginalised by European overlords and their descendants.

But after a bruising struggle between supporters and opponents of President Evo Morales, the country is now poised to adopt a new constitution which could prove a watershed for South America. A referendum on Sunday is expected to endorse a charter which supporters say will empower the indigenous majority and roll back half a millennium of colonialism, discrimination and humiliation.

Indigenous leaders gathered in the baroque hall of La Paz's presidential palace this week to give thanks to their champion Morales, a former llama herder who rose to the highest office and delivered, as he promised, a revolution.

In a scene unimaginable just a few years ago the visitors, dressed in the ponchos, colourful skirts and bowler hats of highland peasants, played pan pipe music, chewed coca leaves and spilled alcohol on the mahogany floor as an offering to Pachamama, or Mother Earth, a goddess revered in the Andes.

"We will offer unanimous support to this new constitution," said David Choque, a traditional Aymara leader. His companions exploded in cries of "Jallalla", a call to arms and expression of triumph. Half a century ago indigenous people were banned from the palace.

Opinion polls suggest that despite the efforts of the conservative opposition, the 411-article charter will prevail, enshrining radical policies to extend state control of the economy and tilt Bolivia in favour of its underclass.

Morales, an abrasive and charismatic figure elected in 2005 as the first indigenous president, wept for joy when the draft was agreed last October. It would redress grievances dating to the Spanish conquest, he said. "We have made history. I can now go to the cemetery a happy man."

The charter will confirm Bolivia, South America's second-poorest country after Guyana, as a leader in the regional "pink tide" of leftist governments which have ousted traditional elites and challenged US influence.

Addressing a rally last night night, Morales said voters would make Bolivia's "democratic revolution" irreversible.

"Patriots, we are not visiting the palace, we are here to stay for life," he told cheering crowds.

"Millions of Bolivians will guarantee the approval of the new constitution to refound Bolivia as a new state with equal opportunities, a new state where everyone will have the same rights and duties."

But not everyone is celebrating, and Morales's fight to "refound" Bolivia is not over. Conservative opponents in the eastern lowlands, a semi-tropical stronghold of paler-skinned European descendants, reject the constitution as a recipe for ruin, division and authoritarianism.

They fiercely resisted its drafting and mounted street protests which turned into bloody clashes with pro-government supporters, including miners armed with dynamite and peasants with machetes. Several people died, hundreds were injured and the country was left dangerously polarised.

"This constitution is making a big mistake by giving more rights to the indigenous [population] and less rights to the people of mixed race. As South Africans did some years ago, we need to unite," said Oscar Ortíz, the senate president.

By mimicking the wholesale nationalisations and hostility to private enterprise espoused by Venezuela's president, Hugo Chávez, the charter invited disaster, said Ortíz. "This will isolate Bolivia." The opposition hopes to unite behind a single candidate against Morales in elections later this year.

Radical elements in the lowlands have pushed for autonomy to stymie the constitution's implementation in at least four provinces, a high-risk defiance of central government authority. "There will be violence," said Victor Hugo Rojas, a leader of a youth group in Santa Cruz. "We are ready for confrontation if necessary."

Some of the 50-page charter's most controversial provisions include state control over natural resources, tough penalties against privatisation, and the separation of church and state. Christian groups joined the campaign with the slogan: "Choose God, Vote No."

Wide-ranging provisions extend the rights of Bolivia's 36 indigenous groups and grant indigenous systems of justice the same status as conventional courts which are widely considered inefficient and corrupt.

Morales was forced to make important concessions in the text. He promised to stand for just one more term, meaning he must vacate the presidential palace by 2014.

He also diluted land reform so that any limits on the size of estates will not be retroactive. In addition, big landowners will be protected from peasant invasions or government confiscation if they can show their land is productive.

Some members of the president's party, the Movement Toward Socialism (MAS), complained the concessions went too far and that ambiguous wording left some provisions unclear.

Loyola Guzman, a former guerrilla who fought with Che Guevara and helped draft the constitution, was disillusioned. "This text generated more polarisation instead of uniting us. And there are many inconsistencies."

Few doubt the president, who won 67% in a recall election last year, will triumph on Sunday. But with the opposition preparing for a campaign of attrition, and prices for Bolivia's commodities falling, the future is murky.

"The new constitution may get ample political backing [but] surely won't solve many of the pressing governance challenges facing the Morales administration," said Michael Shifter, of the Inter-American Dialogue thinktank. "These will become even more acute as overall economic conditions worsen this year. The question will be how Bolivia's political forces interpret and carry out the many ambiguous clauses in the new constitution."

Indigenous leaders recognise the text is imperfect and that fresh battles loom: at the ceremony in the presidential palace they gave Morales a whip to help him tame opponents.

But for them this is a moment to savour. The election of Morales was the first flexing of indigenous power; the constitution affirmed it was here to stay, said Eugenio Rojas, head of the Red Ponchos, a radical Aymara group.

"We are indigenous people that for the first time in history are in power. We will fight to keep this constitution, we will fight hard to make it work and be respected."

He gestured to the snow-capped highlands of Achacachi, a bare landscape of llamas and shacks which contain the bones of rebels executed and dismembered by the Spanish. "We want to be an example to other peoples, to show the world that us, the indigenous, can manage a country."