Brazil's former president Jair Bolsonaro has been sentenced to 27 years and three months in prison for attempting a coup to stay in power after his 2022 election defeat.

The far-right politician, who ruled Brazil between 2019 and 2022, is under house arrest in the capital, Brasilia.

A panel of five Supreme Court justices handed down the sentence several hours after they found the 70-year-old guilty on five counts.

The counts were trying to stage a coup, being part of an armed criminal organisation, attempting violent abolition of the democratic rule of law, being implicated in violence, and posing a serious threat to the state's assets and listed heritage.

Bolsonaro's lawyers have said they will appeal against the verdict.

The ruling marks a historic moment for Brazil, will deepen political divisions and is also likely to prompt a backlash from the United States government - with Donald Trump already sharing his thoughts on the vote.

Bolsonaro is the first former Brazilian president to be convicted of attempting a coup.

He has not attended the court proceedings, and on Thursday, he was seen at the garage of his property, but did not talk to the media.

President Trump, an ally of Bolsonaro, has said he was surprised and "very unhappy" with the decision.