Brazilian President Dilma Rousseff lost a crucial impeachment vote in the lower house of Congress on Sunday and appeared almost certain to be forced from office in a move that would end 13 years of leftist Workers' Party rule.
As thousands of pro- and anti-impeachment protesters demonstrated outside Congress, the opposition comfortably surpassed the two-thirds majority needed to send Rousseff for trial in the Senate on charges of manipulating budget accounts.
The floor of the lower house was a sea of Brazilian flags and pumping fists as dozens of lawmakers carried the deputy who cast the decisive 342nd vote in their arms. In Brazil's largest cities of Sao Paulo and Rio de Janeiro, fireworks lit up the night sky and cars honked their horns in celebration after the vote.
If the Senate now votes by a simple majority to proceed with the impeachment as expected in early May, Rousseff would be suspended from her post and be replaced by Vice President Michel Temer as acting president pending her trial. Temer would serve out Rousseff's term until 2018 if she is found guilty.
The impeachment battle, waged during Brazil's worst recession since the 1930s, has divided the country of 200 million people more deeply than at any time since the end of its military dictatorship in 1985.
It has also sparked a bitter battle between the 68-year-old Rousseff and Temer, 75, that appears likely to destabilise any future government and plunge Brazil into months of uncertainty.
Despite anger at rising unemployment, Rousseff's Workers Party can rely on strong support among millions of working-class Brazilians, who credit its welfare programs with pulling their families out of poverty during the past decade.
"The fight is going to continue now in the streets and in the federal Senate," said Jose Guimaraes, the leader of the Workers' Party in the lower house. "We lost because the coup-mongers were stronger."
Brazil's presidential chief of staff Jaques Wagner said the government is confident the Senate will dismiss the impeachment of President Dilma Rousseff.
Opinion polls suggest more than 60 percent of Brazilians support impeaching Rousseff, Brazil's first female president.
While she has not been accused of corruption, Rousseff's government has been tainted by a vast graft scandal at state oil company Petrobras and by the economic recession.
Hundreds of thousands of demonstrators from both sides took to the streets of towns and cities across the vast nation. Millions watched the congressional vote live on television in bars and restaurants, in their homes or on giant screens in the street, like they would for a big soccer match.
On the grassy esplanade outside Congress, a 6.5-foot-high (2-metre) security barrier ran for more than 1 km separating rival demonstrations, a symbol of the political rift that has emerged in one of the world's most unequal societies.
As the vote came to an end, hundreds of Rousseff supporters sat downcast on red flags and banners on the grass. A young couple, on the verge of tears, hugged each other.
On the pro-impeachment side of the wall, protesters sang and danced, drinking beer and munching popcorn. Some took selfies and performed handstands, celebrating a decision that many said was a victory against corruption.
"Impeachment sends a clear message that the politics of this country needs to be cleaned up," said Alesandra Dantas, a 28-year-old social worker.