Peru’s center-right President Pedro Pablo Kuczynski announced his resignation on Wednesday after vote-buying allegations ensnared him in a fresh scandal on the eve of an impeachment vote, capping months of political turmoil in one of Latin America’s most stable economies.

Kuczynski, a 79-year-old former Wall Street banker who once held U.S. citizenship, promised a “constitutional and orderly” transition of power to end what he described as a hostile political climate that had made governing nearly impossible.

But Kuczynski, who is expected to be replaced by Vice President Martin Vizcarra on Friday, denied allegations of wrongdoing and blamed the premature end of his five-year term on the right-wing opposition party that controls Congress.

“I’ve worked for nearly 60 years of my life with complete honesty. The opposition has tried to depict me as a corrupt person,” Kuczynski said in a pre-recorded video message to the nation that broadcast as he left the presidential palace.

But Kuczynski added, “I think what’s best for the country is for me to resign. … I don’t want to be an obstacle for the nation’s search for a path to unity and harmony.”

Lawmakers agreed to accept Kuczynski’s resignation instead of moving forward with a vote scheduled for Thursday on whether to oust him on grounds he was “morally unfit” to govern, said the president of Congress, Luis Galarreta.

Galarreta said he would swear Vizcarra in as president at around midday Friday.

Ahead of the new impeachment vote on Thursday, the country’s most powerful opposition party, Popular Force, released a raft of video and audio that appeared to show Kuczynski’s allies offering lucrative public-works contracts to lawmakers in exchange for political support.

Kuczynski said the recordings had been edited unfairly as part of a campaign to discredit his government and stressed that no corruption allegation had been proven.

A former governor of a mining region who once helped secure community support for Anglo American PLC’s Quellaveco copper project, Vizcarra has served as Peru’s ambassador to Canada since September and is currently in Ottawa.

In recent days, Vizcarra has received public assurances from opposition lawmakers that they will support his government. But he will take office amid a fractured party, widespread disgust for elected officials in Peru and inherit economic growth that slowed to 2.5 percent last year.

Vizcarra, who turns 55 years old on Thursday, appealed to the public to pull through the crisis on Twitter. “I’m outraged by the current situation like the majority of Peruvians. But I’m convinced that together we can show that we can once more push forward.”

Kuczynski had been scheduled to welcome Donald Trump on the U.S. president’s first visit to Latin America next month, where many of the region’s leaders plan to pressure Venezuelan President Nicolas Maduro to enact democratic reforms.

A White House official, speaking on background, said Trump still plans to attend the summit.

Kuczynski’s resignation marked a spectacular downfall for a man who was elected less than two years ago amid hopes he would turbocharge growth while cleaning up government corruption and modernizing the Andean nation of some 30 million people.

Markets that had cheered Kuczynski’s rise to power rallied on news of his resignation on Wednesday, amid expectations it would end the political uncertainty that has shadowed Peru since the opposition first sought to oust Kuczynski in December.

Popular Force tried to impeach Kuczynski in December after revealing his company received money from Odebrecht — a Brazilian company at the center of Latin America’s biggest graft scandal — while he held public office more than a decade ago.

Kuczynski unexpectedly stayed in power in December with the help of former autocratic Alberto Fujimori, whom he pardoned from a human rights sentence days later in what was widely seen as political payback.