Venezuela’s opposition has accused president Nicolás Maduro of masterminding an illegal parliamentary “coup” after an apparent bid to decapitate the challenge from his presidential rival Juan Guaidó by replacing him as head of the country’s opposition-controlled parliament.

Guaidó shot to international prominence last January after he was elected president of Venezuela’s national assembly and used that position to declare himself the country’s legitimate interim leader.

On Sunday Guaidó had hoped to extend his leadership of the anti-Maduro movement by being re-elected as the assembly’s president for another year.

But there were scenes of chaos and confusion as security forces and riot troops blocked opposition lawmakers and journalists from entering the parliament building in Venezuela’s capital, Caracas.

The moment Juan Guaidó tries to jump a fence to get inside the parliament as the PSUV’s ‘opposition’ candidate Luis Parra is illegally sworn in as president of the National Assembly pic.twitter.com/4p6lgO3qBf — Germania Rodriguez Poleo (@iamGermania) January 5, 2020

Dramatic video footage showed Guaidó attempting to climb over a fence into the assembly’s grounds but being repelled by members of Maduro’s Bolivarian National Guard.

After a lengthy stand-off, Luis Parra – nominally an opposition politician who many suspect has been co-opted by Maduro – declared himself the assembly’s new president with support from pro-Maduro members, while many Guaidó backers remained outside.

The move sparked outrage among Guaidó supporters in and outside Venezuela. At an improvised session in the headquarters of a local newspaper, pro-Guaidó lawmakers re-elected him as national assembly president, meaning that it – like Venezuela – now had two rival leaders.

“Today, once again, we have defeated the dictatorship,” Guaidó told supporters. “We have resoundingly defeated the dictatorship’s intentions.”

The United States criticised the Maduro regime’s move, saying it would not recognize what it called a desperate and phoney “farce” that went “completely against the will of the people”, adding: “Democracy cannot be intimidated.”

A European Union spokesperson said the day’s events were unacceptable and represented “a new step in the deterioration of the Venezuelan crisis”. “As a consequence, the EU continues to recognise Juan Guaidó as the legitimate president of the national assembly,” the EU added.

The foreign minister of Brazil’s far-right government, Ernesto Araújo, accused Maduro of attempting to forcefully prevent Guaidó’s re-election, tweeting: “Brazil will not recognize any outcome of this violence and this affront to democracy.”

But there was also criticism from Argentina’s new left-wing government. “Forcibly preventing the functioning of the national assembly means condemning oneself to international isolation,” tweeted its new foreign minister, Felipe Solá.

The move appeared designed to further weaken Guaidó, who recently vowed 2020 would be Venezuela’s “year of freedom” despite the growing impression that his campaign against Maduro is faltering.

More than 50 governments including the United States, the United Kingdom and Brazil recognized Guaidó as Venezuela’s president, based on his leadership of the assembly and suspicions Maduro had stolen the 2018 presidential election.

Despite that backing, mass street protests, and at least two attempts to spark military uprisings against Maduro, Guaidó has failed to topple Hugo Chávez’s authoritarian heir, who still enjoys support from China and Russia.

In a recent interview with El País, Guaidó denied his movement had failed and compared himself to a jogger entering “the final lap” of the quest for political change.

In a televised speech on Sunday afternoon, Maduro recognized Parra’s leadership and attacked Guaidó as a “puppet of North American imperialism”.

But Christopher Sabatini, a senior fellow for Latin America at the Chatham House thinktank, said Maduro’s “brutal and ham-fisted” move could backfire by “re-legitimizing” Guaidó as a “democratic martyr”.

Guaidó’s international supporters would remain loyal, even if he did not retain his position at the head of the national assembly. “They won’t abandon him,” Sabatini predicted.