Under Peruvian law, an election victory for Keiko Fujimori would see graft charges suspended until after her term, but defeat would see her go to trial.
Peruvian socialist Pedro Castillo is maintaining a slim lead over rival Keiko Fujimori with 99.998 percent of the votes counted and as electoral authorities met to scrutinise contested votes.
Castillo, an elementary school teacher and political novice who won widespread grassroots backing for pledges to rewrite the constitution of the world's No 2 copper producer and redistribute wealth, had 50.2 percent of the vote, maintaining a 0.4 percentage point lead over right-wing Keiko Fujimori, or 71,441 votes.
Some 300,000 contested votes are being scrutinised by an electoral jury, a process that will take several days to complete and could delay the announcement of who will be the next president to take over from interim leader Francisco Sagasti at the end of July.
However analysts said any outstanding votes were now unlikely to tip the balance.
"Pedro Castillo is all but certain to be the next president," said Eileen Gavin, principal analyst of Global Markets and the Americas for United Kingdom-based risk consultancy Verisk Maplecroft.
Fujimori alleges fraud
On Wednesday night, Fujimori, the daughter of polarising former president Alberto Fujimori, alleged that about 500,000 votes were suspicious, without providing substantial evidence. She questioned the likeliness of voting tables grouping up to 300 ballots in which she got no votes at all.
"We think it is crucial that these (allegations) be analyzed in the final count," Fujimori said, who added that she was not saying that electoral authorities were complicit in any wrongdoing.
The ethics tribunal of the National Jury of Elections (JNE), the body charged with overseeing the legality of the electoral process, said in a statement on Twitter on Thursday morning that throwing doubt on the results without evidence, and calling for protests as both camps have done since the vote on Sunday night, was "irresponsible."
"They feed a climate of social polarisation and weaken electoral organisms," the statement said.
Veronika Mendoza, a centre-left candidate in the first round of the presidential election in April who has thrown her weight behind Castillo and lent several advisors to his campaign, told local radio on Thursday morning of Fujimori's claims: "They are seeking to generate chaos and strike out at democracy."
Castilo's Peru Libre party has strongly denied the claims and electoral observers say the vote was carried out cleanly.
The allegations, with some echoes of the legal wrangling after the US election last year, may trigger weeks of confusion and tension, amid a polarized election cycle that has divided Peruvians, with higher-income citizens supporting the right-wing candidate and lower-income ones supporting Castillo.
Peru prosecutor seeks custody for Fujimori
Meanwhile, a Peruvian prosecutor asked a court to order preventive custody for Fujimori, who is accused of corruption and trailing in the final tallying of votes.
Prosecutor Jose Domingo Perez asked an organized crime court to revoke Fujimori's parole and remand her in custody for allegedly having met with a witness in a pending corruption case against her.
The right-wing populist politician is accused of having taken money from scandal-tainted Brazilian construction giant Odebrecht to fund previous presidential bids in 2011 and 2016. She denies the charges, but spent 16 months in pre-trial detention in the lead-up to Sunday's runoff presidential election in which she faced off against far-leftist Pedro Castillo.
Fujimori, 46, was legally allowed to contest the election as she had not been convicted of a crime.
Under Peruvian law, an election victory would see the charges suspended until after her term, but defeat would see her go to trial.
Prosecutors have said they would seek a 30-year jail term for Fujimori.
Domingo Perez said that Fujimori had made contact with a witness named Miguel Torres Morales in breach of her parole terms.
Peru, which saw three presidents in a week last year amid political scandals and protests, has been hit by the world's deadliest Covid-19 outbreak by deaths per capita, and posted its worst economic plunge in three decades last year.