Brazilian lawmakers on Sunday authorized impeachment proceedings against President Dilma Rousseff in a rowdy, circus-like showdown that plunged Latin America's biggest country into profound political crisis.

Opposition deputies in the lower house of Congress needed 342 of the 513 votes, or a two thirds majority, to send Rousseff to the Senate, which will now decide whether to open a trial. They got there after five hours of voting.

Wild cheering erupted from the opposition at the 342nd vote, countered by furious jeering from Rousseff allies in a snapshot of the radical and bitter mood consuming Brazil just four months before Rio de Janeiro hosts the Olympics.

Outside Congress, where tens of thousands of people were watching giant TV screens, the split was echoed on a mass scale -- with opposition supporters partying and Rousseff loyalists in despair.

"I am happy, happy, happy. I spent a year demonstrating in hope that Dilma would be brought down," said retiree Maristela de Melo, 63.

Several thousand police stood by and the rival camps were separated by a long metal wall.

If, as many expect, the Senate goes on to impeach the leftist president, Vice President Michel Temer -- who abandoned Rousseff to become a key opponent -- will assume power.

But opposition celebrations could be short lived, analysts say.

Temer would inherit a country wallowing in its deepest recession in decades and a dysfunctional political scene where Rousseff's Workers' Party vows revenge.

"It will not be easy" for Temer, said Andre Cesar, an independent political analyst. "It will be a nightmare."


Senate next

Rouseff, 68, is accused of illegal accounting maneuvers to mask government shortfalls during her 2014 reelection. Many Brazilians also hold her responsible for the economic mess and a massive corruption scandal centered on state oil company Petrobras, a toxic record that has left her government with 10 percent approval ratings.

The president and her allies had lobbied frantically in a last-minute effort to turn the tide, with her mentor, the fiery ex-president Luiz Inacio Lula da Silva, flying back from his home in Sao Paulo to join the final assault.

Now the decision by the lower house moves the matter to the Senate, which is expected to vote in May on whether to open a trial. In case of a green light there, too -- which experts also consider almost certain -- Rousseff would step down for 180 days while the trial got under way.

If the Senate then voted by a two-thirds majority for impeachment, Rousseff would be ousted. Temer would stay on until elections in 2018.

A senior Rousseff ally said there would be no surrender.

"The coup plotters have won here in the house," said Jose Guimaraes, leader of the Workers' Party in the lower house of Congress.

"President Dilma (Rousseff's) government recognizes this temporary defeat but that does not mean that the war is over," Guimaraes said. "The fight will continue in the streets and in the Senate."


Street politics

Huge opposition rallies involving hundreds of thousands of people over the last months have played a big role in turning pressure against Rousseff into an unstoppable avalanche.

Anger on the streets could again play a role as the crisis enters ever higher stakes.

Sylvio Costa, who heads the specialist politics website Congresso en Foco, told AFP that Brazil's troubles are only starting.

"Whoever loses will keep protesting in the streets," he said. "What's certain is that the crisis will not end today."

However, on Sunday the crowds were peaceful so far.

In Brasilia, about 53,000 pro-impeachment demonstrators massed outside Congress, according to a police count. About 26,000 turned out on the pro-Rousseff side of the metal fence.

In Rio de Janeiro about 3,000 people each from the two sides demonstrated at separate time slots next to Copacabana beach.

The atmosphere even became festive, with a funk band singing in Rio and protesters blowing trumpets and vuvuzelas, as if at a football game, in Brasilia.

In Sao Paulo, the financial center, thousands of pro-impeachment supporters thronged the central Paulista Avenue, many of them in the country's green and yellow national football shirts.

In Brasilia, psychologist Eric Gamaliel, 29, said he'd joined pro-Rousseff protesters because impeachment would mean "Brazil loses a lot. The world will lose a lot. It will be a step backwards."

But farmer Silmar Borazio, 50, who made a 20-hour journey to the capital with pro-impeachment supporters, said Brazil needs change.

"The first thing that needs to happen is for Dilma to leave. We are tired of producing revenue and seeing that in the end nothing improves in the country and it gets stolen," he said.