The Brazilian Senate has voted in favour of putting President Dilma Rousseff on trial for breaking budget laws by 55 votes to 22, signalling the end of 13 years of rule by the country's leftist Workers Party. The final vote would make Vice President Michel Temer acting president during her trial, which could last for up to six months. The Senate action came after the lower house voted 367-137 last month in favour of impeachment.

Brazil Dilma impeachment
Brazil's President Dilma Rousseff, accompanied by Chief Of Staff Jaques Wagner, looks from a window at Planalto Palace in Brasilia, as demonstrations go on outsideAdriano Machado/Reuters

Outside Congress a metal fence was erected to keep apart rival protests. About 6,000 backers of impeachment chanted "Out with Dilma", while police used pepper spray to disperse gangs of Rousseff supporters, who hurled flares back. One person was arrested for inciting violence.

Her critics argue she has caused deep damage to Latin America's largest nation, while supporters call the move to impeach her a coup d'etat.

Brazil Dilma impeachment
A man performs at a protest against Brazil's President Dilma Rousseff in front of the Brazilian National congress in BrasiliaPaulo Whitaker/Reuters
Brazil Dilma impeachment
An anti-impeachment demonstrator is frisked after clashes with policeMario Tama/Getty Images
Brazil Dilma impeachment
Anti-Dilma campaigners demonstrate in front of the National Congress in BrasiliaAndressa Anholete/AFP
Brazil Dilma impeachment
Indigenous people demonstrate against the impeachment of Brazilian President Dilma Rousseff in front of the National Congress in BrasiliaAndressa Anholete/AFP
Brazil Dilma impeachment
Police officers use pepper spray on anti-impeachment demonstrators in BrasiliaPaulo Whitaker/Reuters
Brazil Dilma impeachment
Rescue workers helps an injured demonstrator during a protest against the impeachment of President Dilma Rousseff in BrasiliaPaulo Whitaker/Reuters
Brazil Dilma impeachment
An anti-impeachment demonstrator is carried on a stretcher by rescue workers after being overcome by police pepper sprayMario Tama/Getty Images
Brazil Dilma impeachment
A man selling balloons and candy floss shows his dislike of DilmaPaulo Whitaker/Reuters
Brazil Dilma impeachment
Police keep watch outside the Justice Ministry during protestsMario Tama/Getty Images
Brazil Dilma impeachment
Indigenous people show their support for Brazilian President Dilma Rousseff in front of the National Congress in BrasiliaAndressa Anholete/AFP
Brazil Dilma impeachment
A Barack Obama lookalike takes part in a demonstration in support of the impeachment of Brazilian President Dilma RousseffAndressa Anholete/AFP
Brazil Dilma impeachment
Two indigenous supporters of Dilma stand outside the National Congress in BrasiliaAndressa Anholete/AFP

In a momentous session that many Brazilians followed live on television, each senator was given the chance to speak. Brasilia-based consultancy ARKO Advice projected that the upper chamber would vote 57-21 to try Rousseff, with three abstentions or absences.

Under the rules of the impeachment process, each senator was allowed up to 15 minutes to speak, and many made full use of their moment in the spotlight. AP reports that more than 16 hours into the debate, the 50th senator was giving his speech, leaving 21 colleagues still scheduled to talk. Older senators had gone off for naps and were having their aides call when their time to speak was about to come.

Rousseff, who has been in office since 2011, has seen her popularity crushed by Brazil's worst recession since the 1930s and a two-year probe into a vast kickback scheme at state-run oil company Petrobras. The prospect of business-friendly Temer taking power has driven Brazilian financial markets sharply higher this year, on hopes he could cut a massive fiscal deficit, restore investor confidence and return the economy to growth. The political crisis has deepened Brazil's recession and comes at a time when Brazil hoped to be shining on the world stage as it prepares to host the Olympic Games in Rio de Janeiro in August.

Opposition senators blamed Rousseff for running into the ground an economy now considered the worst performing among major developing nations, pursuing what they called populist policies that led to high inflation, recession and unemployment.

Rousseff, 68, was chairwoman of Petrobras when much of the alleged mismanagement occurred, but she has not been accused of corruption. Instead, she stands charged with manipulating government accounts to disguise the size of Brazil's fiscal deficit to allow her to boost public spending during her 2014 re-election campaign, a practice also employed by previous presidents.

Brazil Dilma impeachment
A woman protests against Brazil's President Dilma Rousseff, calling for her impeachment, at Paulista Avenue in Sao PauloRoosevelt Cassio/Reuters
Brazil Dilma impeachment
A demonstrator attends a protest against the impeachment of Brazil's President Dilma Rousseff in Rio de JaneiroRicardo Moraes/Reuters
Brazil Dilma impeachment
A soldier of the presidential guard stands at Planalto Palace in BrasiliaAdriano Machado/Reuters
Brazil Dilma impeachment
Presidential guards take down the flag in front of the Planalto Palace in BrasiliaIgo Estrela/Getty Images
Brazil Dilma impeachment
A guard stands watch at the Planalto presidential palace while a special session is being heldMario Tama/Getty Images

Opinion polls show an overwhelming majority of Brazilians want to see Rousseff impeached. But the surveys also indicate scant popular support for the 75-year-old Temer.

Rousseff has vehemently denied her administration's financial sleight of hand moves constituted a crime and argued that such manoeuvres were used by prior presidents without repercussions. She has stressed that, unlike many of those who have pushed for impeachment, she does not face any allegations of personal corruption.

Brazil Dilma impeachment
Embattled Brazilian President Dilma Rousseff waves as she arrives to speak at a women's rights conference in Brasilia on 10 May 2016Mario Tama/Getty Images

A former member of a Marxist guerrilla group who was tortured during Brazil's 1964-1985 military dictatorship, she has called her impeachment a coup and vowed to fight the process until the last minute. "I will not resign, that never crossed my mind," Rousseff said in a speech, to cheers from supporters.