Opponents of former Brazilian President Jair Bolsonaro celebrated in the streets of Sao Paulo and Rio de Janeiro on Friday after the Supreme Court sentenced him to more than 27 years in prison for attempting a coup to remain in office despite his 2022 electoral defeat.

The event, organized by leftist political movements and grassroots groups, took the form of a festive street party with live samba music, waved flags, and held banners denouncing authoritarianism.

Four of the five Supreme Court justices reviewing the case found Bolsonaro guilty on five counts, in a ruling that will deepen political divisions.

The five counts are: attempting a coup after losing the 2022 race to President Luiz Inácio Lula da Silva in a plot that prosecutors alleged included plans to kill Lula; participating in an armed criminal organization; attempted violent abolition of the democratic rule of law; damage qualified by violence; and deterioration of listed heritage.

It makes him the first former Brazilian president to be convicted of attempting a coup.

The 70-year-old, who has always denied any wrongdoing, can try to appeal the ruling.

He is currently under house arrest in Brasilia.

The sentence doesn't mean Bolsonaro will immediately go to prison.

The court panel has now up to 60 days to publish the ruling.

Once it does, Bolsonaro's lawyers have five days to file motions for clarification.

AP Video shot by Eduardo François

Production by Tatiana Polastri