The jailed ex-president of Brazil, Jair Bolsonaro, has undergone a successful surgery for a double hernia, his wife Michelle says.

The former leader is serving a 27-year sentence for plotting a coup after he lost the 2022 presidential election to his left-wing rival, Luiz Inácio Lula da Silva.

Brazil's Supreme Court granted permission for the 70-year-old to be transferred from the room in the federal police headquarters where he is serving his sentence to a hospital in the capital, Brasília, for the procedure.

Ahead of the surgery, Jair Bolsonaro endorsed the candidacy of his eldest son, Flávio, for the 2026 presidential race.

The former president made his decision known in a handwritten letter that was read out by Flávio Bolsonaro outside the hospital where his father is being treated.

During my life, I have fought tough battles, paying a high price with both my health and my family, to defend what I think is best for our country, Bolsonaro wrote.

I hand over what is most important in the life of a father - my own son for the mission of rescuing our country, Brazil.

Flávio Bolsonaro, a 44-year-old senator, had already announced his decision to run for president for his father's Liberal Party.

Despite the guilty verdict, the older Bolsonaro still wields considerable political influence. Brazil's Congress passed a bill last week to significantly shorten Bolsonaro's sentence but President Lula said he would veto it.

Jair Bolsonaro is expected to be transferred back to federal police headquarters as soon as doctors give the go-ahead.