Peru's Alan Garcia has completed a remarkable political comeback with his victory in Sunday's presidential election, thwarting Venezuelan leader Hugo Chavez's bid to extend his reach in the region and overcoming the legacy of economic collapse, rebel violence and corruption that turned his 1985-1990 government into a disaster.
Mr Garcia beat Ollanta Humala, a radical former army officer supported by Mr Chavez who was preaching a similar brand of nationalism, by 53 per cent to 46 per cent in a second-round runoff, according to the latest official results.
The delighted crowds celebrating outside Mr Garcia's party headquarters on Sunday night said it all: "Listen, Chavez, Alan won!"
Although Mr Garcia squeaked into the second round by only a few thousand votes, he was swiftly embraced by business leaders, commentators and even Peruvians who had sworn never to vote for him again. They saw him as the only way to save the country from a man regarded by many as a dictator in disguise and a puppet of the increasingly powerful Mr Chavez.
"The only loser here is someone who's not Peruvian, who tried to lead us by the nose with the force of his dirty money, who wanted to extend his domination and dictatorship and bring to our country and others his militarism as the repulsive formula of the past," Mr Garcia told cheering supporters.
Mr Garcia spent much of the election's second round trading insults with the Venezuelan leader, who in turn called him a bandit and a thief. Relations between the new Garcia administration, which takes office on 28 July, and Caracas are likely to be tense.
The authoritarian Mr Chavez, his pockets full of the bonanza of booming oil prices, has close ties with Cuba and now Bolivia, where President Evo Morales recently nationalised gas fields in a move widely seen as inspired by his northern mentor. Mr Chavez has also bought up large chunks of debt in Argentina and Ecuador, giving him increasing leverage across the region.
But his interference in the Peruvian campaign ended up hurting rather than helping his man. "This clearly indicates the limit of his ability to have his way, it's definitely a setback," said Vinay Jawahar, an analyst at the Washington-based think-tank the Inter-American Dialogue. The next test of Mr Chavez's appeal will be Mexico's election next month, where leftist Andres Manuel Lopez Obrador was enjoying a comfortable lead in the polls until his rival opponent linked him to the Venezuelan leader.
"In Latin America, there has never been a leader who can stand up to Chavez," said Jorge Del Castillo, one of the most senior figures in Mr Garcia's Apra party. "Now there is."
But Mr Garcia knows his most pressing test is at home, where more than half the country scrapes a living on a little over $1 (55p) a day and the outgoing President Alejandro Toledo has done little to improve their lot. Mr Humala triumphed in poor mountain areas and now leads the biggest force in Congress, and will demand fast results.
Mr Garcia, widely vilified for saddling Peru in 1990 with hyperinflation and soaring rebel violence, acknowledges he was a reluctant choice for many Peruvians and he told supporters he knew his victory "was no blank cheque".
But he earned the nickname "crazy horse" in the 1980s for his hotheaded policies and says he has learned from that and won't make the same mistakes again. He now sees himself as a more natural ally of Chile's Michelle Bachelet or Brazil's Luiz Inacio Lula da Silva, and has been cultivating his new image of statesman since returning to Peru in 2001 from nine years in exile under former President Alberto Fujimori's rule.
He has promised a consensus government and business leaders who would once have been thought mad to back Mr Garcia are now queuing up to talk to him.
A second chance for 'crazy horse'
Alan Garcia was just 35 when he was elected president in 1985 - the start of one of Peru's most turbulent periods of recent history.
After presiding over a couple of feel-good free-spending years, his government rapidly went off the rails as he tried to nationalise the country's banks, limited debt payments -- making Peru an international financial pariah -- and presided over annual inflation that reached 7,650 per cent.
In those days, the anti-imperialist rhetoric flowing from Mr Garcia, who at 57 is still a seductive orator, made him one of the most flamboyant leaders in Latin America. But at home, many Peruvians hated him.
Mr Garcia is well aware of his bitter legacy, repeatedly promising during his campaign that there would be no return to the food queues, shortages and galloping prices for which many Peruvians cannot forgive him.
Mr Garcia's term was also one of the darkest periods of brutal rebel violence by the Shining Path leftist rebel group. The Garcia government itself was tainted by alleged human rights abuses.
By the end of his term in 1990, Mr Garcia's popularity had sunk to around 10 per cent and he was accused of having taken $1m in bribes while in office, which he denied. Charges against him were shelved or lapsed and he has never been convicted of wrongdoing. Nevertheless, he has struggled to convince sceptical voters he is not a crook.
Mr Garcia has admitted his first government was a disaster, but put many of his arrogant mistakes down to "youthful excesses".
He fled into exile in 1992, returning in 2001 for what was to prove an unsuccessful election bid that laid the foundations for his remarkable political resurrection.