WHEN Colombia’s news channels declared Iván Duque the winner of the presidential election on June 17th, 45 minutes after polls closed, many Colombians were relieved. “I was terrified of Gustavo Petro,”—Mr Duque’s left-wing rival—said a woman waiting for the winner to give his acceptance speech at a convention centre in Bogotá. When Mr Duque came on stage he sought to overcome the campaign’s bitterness. He would “turn the page of polarisation”, he promised.

Mr Duque’s victory, with 54% of the vote, was comfortable. The job that awaits him, starting on August 7th, will be arduous. He campaigned as a sceptic of the peace agreement with the FARC, a guerrilla group that ended its 52-year war against the state in 2016. He must now work out how to revise the accord without pushing some former guerrillas into taking up arms. Mr Duque will have to control corruption, which fuelled the anger that gave Mr Petro 8m votes, more than any other left-wing candidate in Colombia’s history. He must speed up sluggish economic growth. And he will also have to step out of the shadow of his mentor, Álvaro Uribe, a former president who inspires as much fear and loathing as Mr Petro.

The son of a prominent politician, Mr Duque has wanted to be president since he was a child. But until six months ago few Colombians knew who he was. He began his career as a protégé of the current president, Juan Manuel Santos. As Colombia’s deputy representative to the Inter-American Development Bank (IDB), Mr Duque helped lead negotiations in 2010 to increase its capital base. He did “the carpentry work of talking to every country”, says Luis Alberto Moreno, who was then the IDB’s president.

Mr Duque’s ticket to the presidency was Mr Uribe, who fervently opposed the peace process launched by Mr Santos. They bonded when Mr Uribe, mandated by the UN to investigate an attack by Israel on a Turkish flotilla in 2010, asked Mr Duque to help. In 2014 Mr Duque was elected to the senate as a candidate of the Democratic Centre, the party Mr Uribe formed to oppose Mr Santos.

For the Democratic Centre, “Duque is a great invention,” says Carlos Cortes, a political analyst. His mentor is a hate figure for many Colombians, who associate the successful offensive against the FARC during his presidency with atrocities by paramilitary groups. Mr Duque is unstained by that history. He is young, charming and sings vallenato, a type of Colombian folk music. Unlike some of Mr Uribe’s allies, he is not under investigation for corruption or links to paramilitary groups.

He will have to prove that he is his own man without alienating Mr Uribe, who remains a powerful senator. To obtain majorities in congress, the new president will have to strike bargains with parties other than the Democratic Centre and its conservative allies.

His trickiest task will be to modify the peace accord, as demanded by the uribistas, without wrecking the peace itself. Their biggest objection is to the “transitional-justice” provisions, which offer lenient sentences to FARC members if they confess to their crimes. Ten members of the FARC, now a political party, will be able to take their seats in congress before they serve any prison time. While the accord says the government should co-operate with farmers to replace coca, the raw material for cocaine, with legal crops, Mr Duque wants to return to the practice, ended by Mr Santos, of fumigating coca from the air.

In his victory speech Mr Duque promised not to tear up the deal, bits of which are part of the constitution. His government will see to it that “justice and security are suitable sisters”, he said. But his notion of justice contradicts that of the FARC’s leaders. Old and war-weary, they are unlikely to return to jungle hideouts. But Mr Duque’s confrontation with the group may add to the growing number of FARC “dissidents” who refuse to accept the accord. They are fighting the ELN, another guerrilla group, and the Clan del Golfo, a mafia linked to demobilised paramilitary groups, for control of the cocaine trade.

A return to aerial fumigation could encourage farmers to sell coca to such groups and to join their ranks. The new president might also end the peace talks Mr Santos has started with the ELN. Mr Duque has set strict conditions, such as requiring the ELN to gather in designated zones before talks begin. The ELN is unlikely to accept that.

Although smaller than the FARC, the group is as resilient. In the 1970s an offensive reduced it to just 36 fighters; it has since built itself back up to about 2,000. The group shelters in next-door Venezuela.

Corruption is as difficult to fight. Like voters elsewhere in Latin America, Colombians are fuming about serial scandals, including revelations that Odebrecht, a Brazilian construction company that bribed politicians across the region, paid some of Mr Santos’s campaign expenses. In congress it is commonplace for representatives to demand pork for their districts, and kickbacks from pork-related contracts, in exchange for passing laws. Mr Duque needs to clamp down on such practices. “If this mess continues, Petro will be president in four years,” says Mauricio Vargas, a political consultant.

Mr Duque will inherit an economy that is recovering from a slump in oil prices that began in 2014 and continued until last year. Unlike Mr Petro, he is friendly to business and does not frighten the financial markets. But the economy suffers from plenty of maladies, including high public debt, an unaffordable pension system that funnels money to the relatively well off, and low productivity. Mr Duque’s main economic proposal is to cut regulation and business taxes, but that will not be enough. To contain the budget deficit, he will need to couple that with higher taxes charged on personal income.

Wherever he turns, Mr Duque will face difficult choices. In pleading for unity, he told his supporters, “I do not recognise enemies in Colombia.” But he belongs to a political clan that has been defined by its enemies. He has work to do.