Opponents of former Brazilian president Jair Bolsonaro celebrated in the streets of Brasilia on Thursday night 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.

Cars honked their horns as crowds gathered outside bars and in public spaces, singing in unison, “It’s time for Jair to leave.”

Journalist Lorena Cordeiro said the ruling showed Brazil was not "always a country of impunity."

Actor Carlos Valessa said it was a day of "historic reckoning."

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.

Bolsonaro’s co-conspirators, all of them former Brazilian officials, were also sentenced for their roles in the attempted coup.

Gen. Braga Netto, Bolsonaro’s former defense minister and running mate in 2022, received 26 years. Admiral Almir Garnier got 24 years. Gen. Augusto Heleno received 21 years and Gen. Paulo Sérgio Nogueira got 19 years. Lieutenant Colonel Mauro Cid, who cooperated with investigations, was given two years under an open regime.

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