By the Associated Press

LIMA, Peru — Peru is lurching into a new period of political uncertainty Tuesday after President Martín Vizcarra dissolved the opposition-controlled congress and called new elections that he contends are needed to uproot the nation’s endemic corruption.

Renegade lawmakers defied the chief of state, staying in their seats late into the night and even voting to suspend him from office and appoint a vice president who recently broke ranks in his place.

But thousands of people took to the streets in the capital waving Peruvian flags and celebrating Vizcarra’s decision in a country where nearly every living president has been implicated in the Odebrecht graft scandal.

“We are making history that will be remembered by future generations,” Vizcarra said in a national address Monday evening. “And when they do, I hope they understand the magnitude of this fight that we are in today against an endemic evil that has caused much harm to our country.”

The stunning turn could spell new instability as Peru grapples with the fallout of the Odebrecht probe, plummeting faith in public institutions and an inexperienced president struggling to govern.

Nonetheless, Vizcarra’s decision was at least initially cheered by Peruvians who have been clamoring for new congressional elections to replace the majority party, led by a former first daughter and presidential candidate who is now behind bars. Hundreds gathered outside congress honking horns, chanting and carrying signs with phrases like “Get out, corrupt politicians!” Others tried to force their way into the legislature to get lawmakers out but were driven back by police with tear gas.

“Peruvians will not shed many tears,” said Steven Levitsky, a Harvard University political scientist who has extensively studied the nation.

Opposition leaders denounced the move as the work of a “dictator,” refusing to leave congress and instead approving a resolution to suspend Vizcarra for “breaking the constitutional order.” Minutes later they swore in Mercedes Aráoz, the vice president who recently broke with Vizcarra over his push to hold early elections next year.

The acts likely carry only symbolic weight since congress is considered vacated.

“I know many Peruvians are upset,” said Aráoz, who was greeted by applauding lawmakers singing the national anthem. “I share that anger but the solution for a crisis like this is not irresponsible gestures.”

Vizcarra, then the vice president, rose to the presidency last year after President Pedro Pablo Kuczynski resigned following revelations that his private consulting firm had received undisclosed payments from Odebrecht, the Brazilian construction giant that has admitted to dolling out millions of dollars to politicians around Latin America in exchange for lucrative public works contracts.

Though with little political expertise on his resume, Vizcarra rose in popularity as he championed anti-corruption initiatives. But he struggled to push legislation through congress, instead repeatedly utilizing a “vote of confidence” through which he could threaten to dissolve the legislature if lawmakers didn’t approve his proposals.

The mechanism is aimed at resolving conflicts between the executive and legislative branch and allows the president to shut down congress if lawmakers reject two such votes. Congress rejected a previous vote of confidence during Kuczynski’s administration.

Most recently, Vizcarra chastised lawmakers for rushing to a vote on replacing six of the seven magistrates on the Constitutional Tribunal. The court is expected to decide several important cases in the months ahead, including a habeas corpus request to free Fujimori, who is being held as prosecutors investigate her for allegedly laundering money from Odebrecht.

Though the terms for all six magistrates had expired, Vizcarra, legal observers and human rights organizations criticized the congressional action for its speed and lack of transparency. The newspaper El Comercio reported Monday that six of the candidates up for consideration are facing potential criminal or civil charges for offenses including kidnapping, extortion and sex abuse.

Peru’s judicial system is notoriously corrupt, with judges caught on wiretaps negotiating deals on sentences for serious crimes.

Vizcarra warned he would dissolve congress if legislators went ahead with the magistrate votes before weighing his own proposal for reforming how magistrates are selected. But lawmakers pushed forward in defiance Monday, accusing Vizcarra of blocking what should be a “simple procedure” conducted in accordance with the law.

César Landa, a constitutional law professor at the Pontifical Catholic University of Peru, said any decisions approved by congress after Vizcarra’s order to dissolve the legislature would carry no weight.

“It’s like fruit from a tree that is already rotten,” he said.

The nation’s armed forces had not expressed any opinion on the dispute as of late Monday. The military’s leadership did not immediately return a request seeking comment from The Associated Press.

Vizcarra’s shutdown is likely to be considered a legitimate use of constitutional powers celebrated by Peruvians who have little faith in elected leaders, Levitsky said.

Nonetheless, he added, dissolving the congress is likely to do relatively little to resolve deeper, structural issues.

“For now democracy is probably safe because everyone is weak,” he said. “That guarantees a certain pluralism, but that leaves Peru vulnerable to a demagogic politician.”