Peru lurched into a new period of political uncertainty Tuesday after President Martin Vizcarra dissolved the opposition-controlled congress and called new elections that he contends are needed to uproot the nation’s endemic corruption.

Opposition 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.

Police officers stand guard in a street near Peru’s congress in Lima on Tuesday. (Guadalupe Pardo/Reuters)

Nonetheless, Vizcarra’s decision was at least initially cheered by Peruvians who have been clamouring 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.

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 Araoz, the vice president who recently broke with Vizcarra over his push to hold early elections next year.

“I know many Peruvians are upset,” said Araoz, 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.”

Aside from congress, however, no other institution appeared to back Araoz. The nation’s military and governors issued statements supporting Vizcarra.

Nonetheless, even if Araoz’s appointment carries purely symbolic weight, the prospect of a protracted legal showdown taking place in the same court at the centre of the dispute appeared to be growing.

Odebrecht scandal ensnares many

Pedro Olaechea, president of the dissolved legislature, told Colombia’s BLU Radio that what will proceed is a “lengthy, tedious and delicate legal matter.”

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 doling out millions of dollars to politicians around Latin America in exchange for lucrative public works contracts.

Protesters are shown in favour of the dissolution of the congress in Lima on Monday. (Cris Bouroncle/AFP/Getty Images)

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 opposition leader Keiko Fujimori, who is being held as prosecutors investigate her for allegedly laundering money from Odebrecht.

In April, former president Alan Garcia was one of nine people arrested in connection with an investigation into bribes distributed by Odebrecht, but the 69-year-old killed himself as police reached his house.

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 offences 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.

Opposition leader Keiko Fujimori, the daughter of a former president, has been detained in connection with a corruption investigation. (Peruvian Justice Palace/Reuters)

Cesar 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.

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

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.”