LIMA, Peru (AP) — President Pedro Pablo Kuczynski survived an impeachment vote in congress late Thursday, thwarting an attempt by opposition lawmakers to oust him over ties to the Brazilian construction giant implicated in the region's biggest corruption scandal.

Legislators cast their votes after 10 hours of debate over a day that began with the president presenting a forceful defense. He insisted he had no involvement in the payments made by Odebrecht to his private consulting firm more than a decade ago and warned that the rushed impeachment process was a threat to Peru's democracy and stability.

Applause erupted inside congress and his supporters cheered and waved Peruvian flags outside as it became clear the opposition would fall short of the two-thirds vote needed to remove Kuczynski.

"Tomorrow a new chapter in our history begins: the reconciliation and reconstruction of our country," Kuczynski tweeted afterward.

The impeachment effort against 79-year-old former Wall Street banker was the latest chapter in the Odebrecht bribery scandal that has ended the careers of some of Latin America's most prominent politicians. The company admitted in a 2016 U.S. Justice Department agreement to paying nearly $800 million in kickbacks to politicians, their campaigns and political parties to secure lucrative public works contracts.

In Ecuador, Vice President Jorge Glas has been sentenced to six years in jail for orchestrating an Odebrecht bribery scheme. Former Brazilian President Luiz Inacio Lula da Silva is appealing his conviction on charges of corruption and money laundering related to the plot. In Peru, two former presidents stand accused of accepting money from Odebrecht. One is behind bars and the other in the U.S. seeking to avoid extradition.

Kuczynski came under fire after an opposition-led investigative committee revealed documents last week showing Odebrecht made $782,000 in payments to his private consulting firm more than a decade ago. Some of the payments overlapped with years that Kuczynski spent as a high-ranking government minister.

During his 30-minute testimony Thursday, Kuczynski showed the contracts in question on an overhead screen, pointing out that none contained his signature. He said he had no knowledge of the payments and that he never favored any company while in office. He characterized the transactions as part of a legal contract between two private companies and said his opponents were trying to force him from power without due process.

"I am here to look you in the eye, and tell you that I am not corrupt and I have not lied," he said, speaking slowly and assertively.

The vote capped a tumultuous eight days in Peru, which is one of South America's most politically volatile nations.

Analysts worried that impeachment could usher in a new period of uncertainty for Peru, an economic bright spot in Latin America that throughout its recent history has vacillated between short spans of democracy and autocratic rule.

"That they would impeach the president is not an unthinkable thing," said Steve Levitsky, a Harvard University political scientist who has spent years studying Peru. "It's that they would do it in a week without serious investigation, without a serious process of public debate."

The vote was pushed by the opposition Popular Force party led by Keiko Fujimori, who is the daughter of jailed former President Alberto Fujimori. She narrowly lost to Kuczynski in last year's presidential election.

Lawmakers debated for more than 10 hours, delivering impassioned speeches that touched on everything from the merits of neoliberal economic policy to a Gabriel Garcia Maruqez short story reference.

The president's detractors contended that he should have disclosed the payments before taking office and that, at the very least, as a high-ranking government minister when the money was paid he should have done a better job to shield himself from potential conflicts of interest.

Opposition lawmaker Milagros Takayama questioned why the president repeatedly insisted until recently that he had no ties to Odebrecht and agreed to go before the investigative commission only after the documents showing the payments were released.

"We deserve a Peru free of corruption and ineptitude," she said.

Polls within Peru had suggested a majority of Peruvians wanted the already deeply unpopular president out of office.

As a senior business leader and statesman with many ties to the private sector, Kuczynski was "sort of Trump-like in not clearly breaking those ties. And he's paying a price for it," Levitsky said.

While Kuczynski managed to avoid impeachment his troubles are not yet over. He is due for questioning at the chief proseuctor's office next week, and a majority opposition rule in congress is likely to make it difficult for him to govern.

___

Associated Press writer Franklin Briceno reported this story in Lima and AP writer Christine Armario reported from Bogota, Colombia.