Bolivia's President Evo Morales reluctantly conceded defeat Wednesday in a weekend referendum aimed at delivering him a fourth term -- his first direct election loss since taking office a decade ago.
"We have lost a democratic battle, but not the war," the indigenous leftwing leader said of the Sunday plebiscite that had proposed a constitutional reform to allow him to run for a new mandate.
Morales, 56, had been refusing to accept defeat until the full count was in.
But, with 99.72 percent of votes tallied showing 51.3 percent against the reform and 48.7 percent in favor, he finally bowed to the outcome.
"We respect the results, it is part of democracy," he told a press conference at the presidential palace, adding: "The struggle goes on."
The official results were in line with exit polls published by private media since the weekend.
Morales is already Bolivia's longest-serving leader since independence from Spain in 1825.
Under Bolivia's constitution, the president gets a five-year mandate renewable just once.
Morales already had the constitution changed once, three years after taking power in 2006.
Under that revised constitution he was again elected president in 2009, then won his one-off renewal in 2014. His current term ends in 2020.
He has wide support from indigenous groups and grassroots organizations in one of the Americas' poorest countries. Bolivia's mineral and gas-rich economy has more than tripled in size during his time in office.
Opposition groups had feared Morales' delay in acknowledging the result might have indicated the government was preparing to manipulate the result.
Groups had chanted "Fraud! Fraud! Fraud!" during a sit-in outside the La Paz office where votes were being counted late Monday.
However, the general mood across the country of 10 million was calm.
Opposition figures celebrated their victory, especially in anti-Morales bastions such as Potosi and Santa Cruz.
"We have recovered democracy and the right to choose," said Samuel Doria Medina, whom Morales twice defeated in presidential elections.
Despite Morales' declaration that his Socialist "struggle" would continue regardless of the poll loss, the president is on the record as saying he was ready to go quietly into political retirement.
"With my record, I can leave happily and go home content. I would love to be a sports trainer," the Spanish newspaper El Pais quoted him as saying. Morales is a noted football fan who plays with local teams.
His popularity, though, has suffered from allegations that he used his influence in favor of contracts for CAMC, a Chinese engineering company that employs his ex-girlfriend.
Opponents accuse him of presiding over corruption and wasteful spending.
Morales's defeat could disrupt the remainder of his term and his Movement to Socialism (MAS) party, a grouping of unions and social movements, analysts say.
It "will probably cause an internal struggle to replace him," analyst Andres Torres predicted.
But Morales downplayed that threat Wednesday, insisting the MAS still enjoyed broad support.
"It is one thing to vote for a change (in the constitution), it's another to back a candidate," he said.
Analysts at the Eurasia Group consultancy said Bolivia's relatively strong economy made it "unlikely" that the country would suffer instability in the short term.