LA PAZ, Bolivia — A referendum that would allow the Bolivian president, Evo Morales, to run for a fourth term looked imperiled on Sunday, as early exit polls predicted that it would fail by a small margin and the president’s rivals declared victory.
Television exit polls showed that a slim majority of voters, in the single digits, had turned down Mr. Morales’s bid to change the Constitution to allow him to run again and possibly serve as president until 2025.
“Today we have buried the project of converting our country into a single party, of converting our country into an authoritarian state,” said Samuel Doria Medina, an opposition legislator. “This is a victory of the people over abuse.”
However, Álvaro García Linares, Mr. Morales’s vice president, said the opposition had declared a premature victory. He said that the polls showed a “technical tie” and that the final result may vary from them.
If the margin holds, it would represent a sharp turn of fortunes for Mr. Morales, perhaps Latin America’s most visible leftist leader and his country’s first indigenous president.
An Aymara Indian, Mr. Morales is widely credited with stabilizing Bolivia and making it more inclusive after decades of white leadership. His Movement Toward Socialism party has presided over 5 percent annual economic growth. In 2014, he was re-elected to a third term with 60 percent of the vote.
But 10 years in office have left his popularity strained. As the referendum campaign drew to a close, Mr. Morales struggled to defend himself against a scandal involving an illegitimate child and accusations of corruption. He also faced abandonment by many members of the groups that had brought him into office, including indigenous people and coca growers.
“What we have seen is the fractures in the socialist movement,” said Franklin Pareja, a Bolivian political scientist. “It hasn’t imploded, but the implosion is beginning.”
Mr. Morales, 56, is not alone among leftist leaders in Latin America facing troubles. Dilma Rousseff, Brazil’s president, faces impeachment proceedings over a corruption scandal involving the state oil company. As economies slumped in Venezuela and Argentina, voters turned against socialist-leaning populists for the first time in years, replacing them with market-oriented rivals.
Mr. Morales’ supporters vigorously defend his legacy. José Alberto Gonzales, the president of Bolivia’s Senate and a member of the president’s party, said Mr. Morales had done nothing short of creating a new Bolivia, in which the country’s immense natural gas wealth was redistributed to the indigenous poor. “Now the state plays the role of protagonist,” Mr. Gonzales said.
Some of the indigenous constituents who made Mr. Morales’s movement possible, however, now say the opposite.
One arena of dispute is the National Council of Ayllus and Markas of Qullasuyu, a powerful federation of indigenous tribes that once backed the president. When its leadership began to disagree with Mr. Morales several years ago, the president created a parallel body that was friendlier to his administration.
Those who did not join the new organization say they were ignored. Cristóbal Huanca, an indigenous leader who lives along Bolivia’s Lake Poopó, said he and his people had watched as the combination of water diversion and climate change caused the lake to evaporate. The government did little to help, Mr. Huanca said.
“Our brother Evo can’t do anything about climate change, but he always speaks about Mother Earth and does little to defend it,” Mr. Huanca said.
Accusations of strong-arm tactics echo in El Alto, a large, indigenous city high in the Andes. Residents there broke with the president’s party last year, electing as mayor Soledad Chapetón, who opened corruption investigations against union leaders aligned with the party.
On Wednesday, a fire set by a mob at the mayor’s offices destroyed documents related to the investigation and killed six people, including the lawyer heading the inquest. On Thursday, Braulio Rocha, a union leader, and Wilmer Sarzuri, a former candidate from Mr. Morales’ party, were arrested in connection with the fire.
Although the government has denied any connection to the killings, voters like Rita Ticona, a 32-year-old teacher in El Alto, said that the events had frightened her and that she would be voting against giving Mr. Morales a chance at a fourth term.
“It’s a shame for this country,” she said. “The political situation has been taken advantage of to commit crimes and end lives.”
As all this happened, Mr. Morales was struggling to defend himself against a sex scandal and revelations that he had fathered a child out of wedlock.
Last month, Bolivian journalists reported that Mr. Morales’s 29-year-old girlfriend had profited as a senior executive at a Chinese company with $500 million in state contracts.
At first, Mr. Morales, who is not married, said he had ended the relationship, but photos soon surfaced of the couple embracing last year.
In a related scandal, Mr. Morales said that he had fathered a child with the same girlfriend, but that after “bad luck” the baby died in 2007. He has not produced a death certificate.
The scandals have not gone over well with voters, said Ludwig Valverde, a Bolivian political scientist. “If your son died, what father could brush this off so lightly?” he said. “What a terrible image it’s made, especially with women.”
Other misconduct accusations have dogged Mr. Morales.
Some center on Fondo Indígena, a program that finances indigenous development projects with money collected from the country’s natural gas rents. Diego Ayo, a political-science professor at the Higher University of San Andrés in La Paz, said at least $180 million of the fund’s assets were unaccounted for.
One fraud allegation says the fund had pledged to give an indigenous community a shipment of blackface sheep, known for their high-quality wool and meat. But during a rainy presentation ceremony, officials were chagrined when paint on the sheep’s faces washed away, Professor Ayo said.
“It’s become a negative cycle of arrogance,” Professor Ayo said.
Yet for voters like Jaime Apaza Choque, a 25-year-old taxi driver, accusations of corruption will not be enough to change their minds. Mr. Choque, a father of five, said that he had managed to hold down steady work under Mr. Morales and that he would reward the president with his vote.
“He wasn’t the only one to steal, the others did exactly the same,” Mr. Choque said. “And I don’t know that what’s been said is true. In the meantime, I am able to care for my family and I’m good. So I support him.”
An earlier version of this article misstated the year that Soledad Chapetón was elected mayor of El Alto. It was last year, not 2014.