Protesters have stormed Paraguay's Congress building and set it on fire after a secret Senate vote to approve a bill that would allow President Horacio Cartes to run for another term.

Hundreds of people clashed with riot police in Asuncion on Friday and broke into Congress, battering down entrances and fences and shattering windows.

Once inside, they ransacked the offices of legislators who backed the reform and started fires, television images showed.

The fire service said some 30 demonstrators and police were injured in the violence.

Earlier in the day, the vote on the constitutional amendment took place during a special session held in a closed office in Congress rather than on the Senate floor.

Protesters in #Paraguay set fire to Congress after Senate secretly votes to let president run for re-election. https://t.co/4p25jBNLI6 pic.twitter.com/J0Ucmm9fOV — AJ+ (@ajplus) April 1, 2017

Opponents of the measure, who say it clears the way for dictatorships, said the vote was illegal.

"A coup has been carried out. We will resist and we invite the people to resist with us," said Senator Desiree Masi from the opposition Progressive Democratic Party.

Marching protesters were met by police wielding water hoses and firing rubber bullets and after nightfall, as the demonstrations grew more violent, police in riot gear responded by lobbing tear gas.

The president called for calm and a rejection of violence in a statement released on Twitter.

"Democracy is not conquered or defended with violence and you can be sure this government will continue to put its best effort into maintaining order in the republic," Cartes said.

Journalist Laurence Blair, in Asuncion, said protesters dispersed late at night and firefighters could put out the fires.

He explained that the political situation in Paraguay is complex and that the protests should not be seen as simply a popular uprising against Cartes.

The president's Colorado Party, which has dominated Paraguayan politics for most of the past 70 years, is divided, Blair told Al Jazeera. Some members of the party were probably involved in the protests, he said, as well as left-wing supporters and some people who just wanted to vent their frustration with the political situation.

Local media reported that several politicians and journalists were among the injured.

Interior Minister Tadeo Rojas said many police were hurt after being provoked by a small group of protesters.

"The national police were not under any instruction to repress. They were attacked," Rojas said in a news conference.

Cartes is seeking to reform the constitution to let him run for office again in 2018.

Presidents are now limited to a single 5-year term.

The bill will pass to the lower house Chamber of Deputies, where the president has a majority, for another vote.

Approval there would require the electoral court to call a referendum on the reform within three months.

If implemented, the measure would apply to future presidents and Cartes, as well as former presidents, including Fernando Lugo.

"Everything was done legally," said Senator Carlos Filizzola of the leftist Guasu Front coalition, which supports the constitutional amendment as a way of allowing Lugo to come back as Paraguay's leader.

Lugo was removed from power by the Senate in 2012 in the wake of a land dispute scandal.