Security forces violently repressed protests that broke out in Venezuela's capital on Friday after the supreme court gutted the opposition-controlled Congress of its last vestiges of power.

The move on Thursday drew widespread condemnation from foreign countries and even triggered a sharp rebuke from the nation's normally pro-government chief prosecutor.

Governments across Latin America condemned the power grab, which the head of the Organization of American States likened to a "self-inflicted coup" by socialist President Nicolas Maduro. The United Nations' top human rights official expressed "grave concern" and called on the high court to reverse its decision.

In Caracas, national guardsmen in riot gear fired buckshot and swung batons at a small group of students who gathered outside the supreme court. Several protesters were arrested and some journalists covering the demonstration had their cameras seized by police before the group reassembled elsewhere.

Venezuela's president accused of coup

Al Jazeera's Alessandro Rampietti, reporting from Cucuta on the Venezuela-Colombia border, said the demonstrations appeared to be spontaneous and limited.

"We're hearing that major protests are being organised in other parts of the country on Saturday. The opposition is divided, however, and this is something the government has been able to use to its favour."

In a surprise pronouncement, Chief Prosecutor Luisa Ortega Diaz, normally a government loyalist, said it was her "unavoidable historical duty" as a Venezuelan citizen and the nation's top judicial authority to denounce what she called the Supreme Tribunal's "rupture" of the constitutional order.

"We call for reflection, so that the democratic path can be retaken," she said to the loud applause of several aides gathered around her.

The ruling and another earlier in the week limiting lawmakers' immunity from prosecution capped a feud that began when the long-marginalised opposition won control of the legislature by a landslide in December 2015 and then mounted a campaign to force Maduro from office.

The leftist leader, who has seen his approval ratings plunge amid widespread food shortages and triple-digit inflation, responded by relying on the Supreme Tribunal of Justice to unseat several legislators and then routinely nullify all legislation voted there.

"What we've lived the last few hours has to be called what it is: a coup and an attempt to instil a dictatorship in Venezuela," National Assembly President Julio Borges said at a news conference.

The decision triggered a frenzy of diplomatic activity, from Buenos Aires, Argentina, where foreign ministers of the Mercosur trade bloc were to gather Saturday to discuss the crisis, to Washington, where the OAS secretary-general called for an emergency meeting.

Peru's government recalled its ambassador in protest of what it called "a flagrant break in the democratic order". The presidents of Chile and Colombia, who have been reluctant to openly criticise Maduro, said they were deeply worried by the ruling and also ordered their ambassadors to return home for consultations.

Mexico's President Enrique Pena Nieto expressed on Friday worry about the "deterioration of democracy".

Nicolas Maduro accused of 'coup' over Congress powers

Luis Vicente Leon, a Caracas-based pollster, said while the ruling completely "pulverises the separation of powers", Venezuela had long ago stopped operating like a normal democracy with a clear rule of law and independent institutions. He predicted the government would harden its position in the face of growing economic woes and international pressure, further dashing hopes for dialogue and an electoral solution.

"It's perfectly predictable that the government is going to keep radicalising," he said.

Maduro kept out of the debate, appearing twice Thursday on state TV but leaving it to his aides to denounce his critics. He also received pledges from anti-American allies such as Russia, which urged external actors to refrain from interfering in Venezuela's internal affairs.

"It's untrue that a coup has taken place in Venezuela," the government said in a statement on Thursday.