Colombians clamoring for "change" gave a leftist ex-guerrilla an historic lead Sunday in a first round of presidential elections that will culminate in a runoff against a maverick outsider in June.

With more than 99 percent of votes counted, preliminary results showed 62-year-old Gustavo Petro, a former Bogota mayor, taking 40.3 percent.

He now has a shot at becoming Colombia's first-ever leftist president and wresting power from the political and economic elites historically at the helm.

About 300,000 armed police and soldiers will keep the peace at 12,000 polling stations
About 300,000 armed police and soldiers will keep the peace at 12,000 polling stations AFP / Yuri CORTEZ

Rodolfo Hernandez, a 77-year-old millionaire and himself an ex-mayor, came out of left field to snatch second place with 28 percent of the vote, denying Petro the 50 percent-plus needed for an outright, first-round win.

Hernandez, who ran on an anti-corruption platform, also edged out right-winger Federico Gutierrez -- a former mayor of second city Medellin who carried the hopes of establishment parties and who pollsters had predicted would finish in second place.

On Sunday, Petro vowed "real change" if elected, and promised to pursue "social justice and economic stability."

About 39 million of Colombia's 50 million people are eligible to cast a vote on Sunday
About 39 million of Colombia's 50 million people are eligible to cast a vote on Sunday AFP / Raul ARBOLEDA

"A company cannot grow if society is impoverished. Profits cannot grow sustainably if the majority of the population (suffers from) hunger," he said.

Leftist candidate Petro has promised to address poverty and make the economy more environmentally friendly
Leftist candidate Petro has promised to address poverty and make the economy more environmentally friendly AFP / JOAQUIN SARMIENTO

Analysts say Petro's road to the presidency has been complicated by Hernandez's late surge.

With his anti-establishment, populist reputation, some polls have suggested Hernandez would stand a better chance than Gutierrez at beating Petro in a second round.

The gloves came off as soon as the results were out, with Petro pointing out that Hernandez is under investigation for graft and asking: "Is this what we want?"

In his speech, a defeated Gutierrez said he would vote for Hernandez in the second round as Petro represented "a danger for democracy."

Federico 'Fico' Gutierrez wants to tackle crime and violence with a 'strong state' approach
Federico 'Fico' Gutierrez wants to tackle crime and violence with a 'strong state' approach AFP / Raul ARBOLEDA

"We do not want to lose the country and we will not put at risk the future of Colombia, of our families, our children," he said.

In a country marked by a deep-rooted fear of the political left -- associated with guerrilla groups that sowed decades of misery -- the pushback against Petro has been fierce, with rivals seeking to paint him as a radical, Hugo Chavez-style populist.

For his part, Hernandez said the results showed that Colombians were "serious about ending corruption as a system of government."

The campaign has been marred by suspicions of fraud, following counting irregularities reported in a primary voting round in March
The campaign has been marred by suspicions of fraud, following counting irregularities reported in a primary voting round in March AFP / JOAQUIN SARMIENTO
Federico 'Fico' Gutierrez wants to tackle crime and violence with a 'strong state' approach
Federico 'Fico' Gutierrez wants to tackle crime and violence with a 'strong state' approach AFP / Raul ARBOLEDA

Some 12,000 polling stations were open for eight hours Sunday in a tense atmosphere one year after a brutal security crackdown on street protests fueled by deepening socioeconomic woes.

More than 8.5 million Colombians voted for Petro, hoping he is the man to address biting poverty, rural violence, urban crime and endemic corruption in a country historically governed by rightist elites.

Hernandez, who is not aligned to a political party, garnered 5.9 million votes and Gutierrez 5.0 million.

"We all want change," 34-year-old hotel porter Elison Beltran, one of Hernandez's voters, told AFP of his choice.

Hernandez had awaited the results with a beer, poolside, at his home, according to video shared by his campaign team.

His politics are often described as inscrutable and not fitting comfortably into any specific political doctrine.

"It is very hard to know what his real policies will be," analyst Michael Shifter of the Inter-American Dialogue think tank told AFP.

"I don't think it was his policies that got him this strong vote, I think it was more his rhetoric and appealing to a lot of disenchanted voters who were very nervous about Petro, basically."

Ivan Duque -- who beat Petro to the presidency in 2018 -- is leaving office with record disapproval numbers after a constitutionally limited single, four-year term.

About 40 percent of Colombia's 50 million people live in poverty, and the country has one of the highest levels of income inequality in the world, according to the World Bank.

Problems were worsened by the coronavirus pandemic, and one in six city dwellers is unemployed.

The government's image was not helped by an internationally denounced response to weeks of anti-poverty protests last year that saw dozens of civilians killed.

Petro, running his third presidential race, has promised to address social inequality and make Colombia's economy more environmentally friendly, including by phasing out exploration for crude oil -- one of the country's main income generators.

Among Hernandez's proposals: closing embassies to pay off student loans and making a visit to the sea at least once in their lifetime a right for all Colombians.

Petro and Gutierrez had both received death threats in the runup to the vote, as has the leftist's running mate Francia Marquez, who could become Colombia's first-ever black woman vice president.

In the morning, dissidents of the disbanded FARC guerrilla group detonated three explosive devices in the southeast, where armed groups are engaged in running battles with drug gangs in a country long plagued by violence.

A soldier was wounded but the defense ministry said there was no impact on voting.

Some 300,000 armed police and soldiers were deployed to keep the peace, with observers from the Organization of American States and European Union also on the ground.