Peru's Pedro Castillo waves to supporters with his running mate Dina Boluarte during a celebration after being confirmed as President-elect on July 19.
Bogota, Colombia CNN  — 

Six weeks after voters headed to the polls in Peru, former schoolteacher and union leader Pedro Castillo has been formally declared the country’s President-elect. He will be sworn in on July 28, the bicentennial of Peruvian independence, election authorities announced Monday.

Earlier Monday, the National Jury of Elections (JNE) unanimously dismissed the final appeals filed by Castillo’s opponent, Keiko Fujimori, regarding allegations of voting irregularities that were found to be unsubstantiated. The JNE said Castillo won the election with 50.126% of the vote. The two candidates were separated by just 44,263 votes – a razor-thin margin for a country with a population of about 33 million.

Castillo’s running mate, economist Dina Boluarte, was declared vice president-elect by the JNE.

The unprecedented delay between last month’s runoff election and Monday’s announcement came because the JNE was required to investigate Fujimori’s allegation. According to Peruvian law, a winner can only be declared after the JNE has revised all vote counts and resolved any complaints by electoral monitors. There is no vote recount in Peru’s electoral system.

Fujimori, the daughter of former Peruvian president Alberto Fujimori, said earlier Monday she would respect the results of the election but did not walk back her earlier allegations of “irregularities” in the voting process. It was her third unsuccessful campaign for Peru’s presidency.

“I’m going to recognize the results because it’s what the law and the Constitution that I have sworn to says. The truth will come out, and we will all work together to restore legitimacy in our country,” Fujimori said at a news conference before Castillo was named President-elect.

Castillo and his party, Peru Libre, have denied the allegations of irregularities.

Castillo and current President Francisco Sagasti called for unity following the announcement. Sagasti said he would recognize the results presented by the JNE as legitimate.

“I welcome the proclamation of Pedro Castillo as president-elect after the announcement of the results by the JNE. Let’s look optimistically at the future of our country,” Sagasti said in a tweet. “Nine days before the Bicentennial, may this be the beginning of a new stage of reconciliation, consensus and unity.”

The election was held at a time of extreme political instability in Peru. Sagasti became Peru’s fourth President in less than five years after Congress voted to oust popular former leader Martin Vizcarra and Vizcarra’s replacement, Manuel Merino, resigned.

Fujimori now faces a corruption investigation that could have been suspended until the end of her mandate if she had won the election, according to a prosecutor working on the case against her.

CNN’s Mitchell McCluskey contributed to this report.