Brazil's lower house of Congress has voted to impeach President Dilma Rouseff after hours of raucous debate. While the decision required a 75% vote, the government officially conceded defeat after 314 of the 513 members of the Chamber of Deputies voted for impeachment and officials realised they did not have enough support to protect the president.

"The fight is now in the courts, the street and the senate," declared Jose Guimarães, the leader of the Workers' Party in the lower house, who conceded defeat with more than 80 votes still to be counted.

The proceedings will now move to the Senate, where there will be a vote on a possible trial. The top job could be handed over to Vice President Michel Temer, who the president has accused of being part of a plot against her.

After months of political wrangling that cracked open deep fissures in Latin America's most powerful economy, legislators in the Chamber of Deputies began voting on the evening of 17 April. Voting started after passionate statements from deputies and party leaders.

Afonso Florence of Rousseff's governing Workers' Party urged his colleagues to have a "democratic conscience," and attacked the president's opponents who are facing their own charges of corruption.

Pro-impeachment member Antonio Imbassahy of the Brazilian Social Democracy Party told lawmakers to "choose the country we want from now on," and called for "moral reconstruction."

House Speaker Eduardo Cunha, who had led the push for impeachment, then began calling on each of the other 512 deputies one by one, giving them time to speak before casting their vote. After each vote cast the chamber erupted in boos and cheers as legislators tracked the board keeping score, according to the Associated Press.

Outside the legislative building in the capital of Brasilia, at least 25,000 demonstrators on both sides of the issue did the same as they watched the proceedings on giant screens erected in the open air. Hundreds of thousands of other Brazilians gathered in towns across the nation. The mood was like a sports event, high spirited and peaceful – for the time being.

Advocates for impeachment dressed in bright yellow and green – the colours of the flag – across the country. Pro-government supporters wore red – the colours of Rousseff's party.

Rousseff faces impeachment over allegations she illegally manipulated figures in the national budget to make it seem as if the nation was doing better than in reality. Critics say her intent was to boost her administration's floundering popularity amid a tanking economy and a massive bribery and corruption scandal involving state-controlled oil company Petrobras that has engulfed dozens of politicians in the Workers' Party and coalition government.

Rousseff has denied wrongdoing, pointing out that previous presidents used similar budgetary sleights-of-hand. She slammed the allegations as a smokescreen to cover up a "coup" by Brazil's traditional ruling elite to snatch power back from her left-leaning party.

"Given that Dilma didn't commit any crime, like so many others in this chamber, which has no shame, I'm voting no!" declared Simone Morgado, a member of the centrist Brazilian Democratic Movement, as she cast her vote. She complained that impeachment proponents were merely trying to derail democracy.

But Luiz Carlos Hauly, a deputy in the main opposition Social Democratic Party, said Rousseff had to go because the split in the legislature had paralysed the government. "In Europe they change their government when it doesn't have the majority," he said. "This administration has no majority. It doesn't have the means to govern."

Representative Paulo Pereira da Silva even sang a song, beginning, "Dilma, go away, because Brazil does not want you".

As the votes ticked by and the evening stretched into night, the future looked progressively bleak for the woman once called "Joan of Arc of the guerillas" by a martial prosecutor. Even long-time supporters pulled away as the result became obvious.

If the Senate next approves an impeachment trial, Rousseff would have to step down for 180 days to defend herself against accusations while she is replaced by Temer. Should that happen, Rousseff's supporters have vowed to take to the streets in retaliation, ensuring a long and chaotic battle ahead.