Embattled President Pedro Pablo Kuczynski offered his resignation Wednesday ahead of an impeachment vote, seeking to put an end to a fast-moving political drama playing out just three weeks before the Andean nation is set to host U.S. President Donald Trump for a regional summit.

In a nationwide televised address, Kuczynski, flanked by his cabinet, lashed out at opponents led by the daughter of former strongman Alberto Fujimori for allegedly plotting his overthrow with damaging leaks of confidential documents that raised doubts about his integrity and made it impossible to govern.

"I don't want to be an obstacle blocking our nation from finding the path to unity and harmony that it so much needs and which I was denied," he said, adding that the campaign in favor of his removal had caused "enormous damage" to Peru's democracy.

Congress was scheduled to debate Thursday on whether to accept the resignation, which would transfer power to First Vice President Martin Vizcarra. It could also decide to reject his offer and plow ahead with impeachment proceedings, which a large majority of lawmakers had favored before Kuczynski resigned.

Beyond the conservative leader's departure, the outlook is uncertain, with many Peruvians expressing disgust with their entire political class -- not just Kuczynski but also his accusers, led by Fujimori's daughter Keiko.

Vizcarra, who is in Canada, where he had been serving as Peru's ambassador, hasn't said whether he would form a government to try and finish Kuczynski's term ending in 2021. If he and the country's second vice president resign in solidarity with Kuczynski, as they vowed during a previous impeachment attempt in December, power would transfer to the head of congress, who would be required by the constitution to call new elections-- for both president and congress -- within a year.

"The only public institution with moral authority left in Peru is the fire department," said Oscar Mendoza, a lawyer standing outside the presidential palace moments after Kuczynski waved goodbye to aides and stepped into a tinted SUV for a lonely drive to his Lima mansion. "All the rest, when you touch them with your finger, pus comes out because they are fully corrupted by graft."

Pressure has been building on Kuczynski to resign after the shock revelation Tuesday of secretly shot videos in which several of the president's allies were caught allegedly trying to buy the support of an opposition lawmaker to block the conservative leader's impeachment.

The videos presented by Keiko Fujimori's party purportedly show attempts by Kuczynski's lawyer, a government official, and Fujimori's son Kenji trying to convince the lawmaker to back the president in exchange for a hand in lucrative state contracts.

Kuczynski said the videos had been heavily edited to smear him and recalled practices from "sad days of Peru's history that we thought had been overcome."

He was referring to Fujimori's longtime spy chief, Vladimiro Montesinos, who secretly recorded himself paying cash bribes to media moguls, military officers and politicians in efforts to gain leverage over potential rivals and boost his almost unlimited power.

Kenji Fujimori led a group of rebellious lawmakers in December who defied his sister's leadership of the Popular Force party to narrowly block Kuczynski's removal. Days later, Kuczynski pardoned the feuding siblings' father from a 25-year jail sentence for human rights abuses committed during his decade-long presidency.

A new impeachment vote had been scheduled to take place Thursday and Kuczynski had been scrambling for support.

Keiko Fujimori, who has publicly distanced herself from her father, had accused Kuczynski of orchestrating the alleged vote-buying scheme.

The videos released Tuesday portray the president's allies trying to lure lawmaker Moises Mamani to their side with promises of lucrative contracts.

In one exchange, Freddy Aragon, the head of the government agency regulating firearms, tells Mamani that he stands to pocket 5 percent of future public works projects authorized by the executive branch in his district. In another, Kuczynski's lawyer hands the waffling lawmaker the transportation minister's cell phone.

"Those who've voted in favor of impeachment have all the doors closed to them," Kenji Fujimori tells Mamani in one of the recordings.

Peru's chief prosecutor as well as congress said they would open a criminal probe into the videos.

Kuczynski is accused of lying as president about $782,000 in payments his consulting firm received a decade earlier from Brazilian construction giant Odebrecht.

Odebrecht is at the center of Latin America's biggest graft scandal, having admitted to paying some $800 million in bribes to officials across Latin America, including $29 million to politicians in Peru.