After a bitterly disputed count that lasted 43 days, hard-left candidate Pedro Castillo was finally declared the winner of Peru's presidential election on Monday night.
Victory for the teachers union leader caps a remarkable rise from the political margins that prompted some among the country’s elite to demand a military intervention in order to prevent the candidate of a small Marxist party being sworn into office on July 28th.
But having seen her multiple allegations of fraud in the June 6th run-off rejected by electoral authorities as unfounded, runner up Keiko Fujimori announced earlier on Monday she would accept defeat "because it is what the law and the constitution require".
The daughter of former dictator Alberto Fujimori, she had threatened not to recognise the result, which saw her lose by just over 44,000 votes from almost 19 million ballots cast. But her campaign's effort to have many of her opponent's votes tossed out despite being unable to substantiate allegations of wrongdoing drew mounting criticism that she was endangering the country's democracy.
After seeing his victory finally confirmed Mr Castillo, who will be sworn in on the day Peru celebrates the bicentenary of its independence from Spain, gave a brief victory speech from the balcony of his campaign's headquarters in Lima. "This is a government of all the races, without any discrimination. No-one will be left behind," he told supporters.
During the race he promised to radically reshape the country’s economy so that income from the powerful mining sector was redistributed towards the poor, heavily indigenous interior. But faced with capital flight and open coup-mongering among elements of the white coastal elite, he has since signalled he will adopt a more technocratic approach.
He also must balance his more radical ambitions with a lack of a majority in congress that in recent weeks has manoeuvred to limit the powers of the incoming president. Even his position within his own Free Peru party is delicate, as its congressional bloc is viewed as more loyal to its leader Vladimir Cerrón.
A neurosurgeon who spent time in exile in Cuba after his father was murdered by the Fujimori dictatorship, Mr Cerrón picked Mr Castillo as the party's candidate only after he was barred from running because of a corruption conviction. Since their surprise victory Mr Cerrón's circle has warned the new president not to distance himself from the party's hardline agenda, which mixes economic radicalism with social conservatism, in an effort to build a broader governing coalition.
Meanwhile, following her defeat Ms Fujimori now faces the threat of 30 years in jail for her role in a corruption scandal involving a Brazilian construction conglomerate.