Brazilian President Jair Bolsonaro once took a stab at predicting the outcome of his 2022 re-election bid: "Prison, death or victory."
Victory it was not. Death came in the form of an end to his presidency, which he grudgingly accepted Tuesday - two days after the election was declared for his opponent.
And prison?
"You can be sure that option... does not exist," the far-right leader told members of his crucial evangelical support base in August 2021.
Analysts, however, believe a future behind bars may be a very real prospect for the bellicose Bolsonaro, even if it may take years.
Almost from the start of his controversial mandate in 2019, Bolsonaro racked up accusations and investigations for everything from spreading disinformation to crimes against humanity.
He survived more than 150 impeachment bids - a record.
Most of these were over his flawed management of the coronavirus pandemic, which claimed the lives of more than 685,000 people in Brazil - the world's second-highest toll after the United States.
While in office, Bolsonaro was shielded from legal consequences by two political allies: Attorney General Augusto Aras and Arthur Lira, the speaker of Brazil's lower house of Congress.
But that will change on January 1, 2023 when his arch-rival, leftist ex-president Luiz Inacio Lula da Silva, takes over the reins once more, and Bolsonaro loses his presidential immunity.
'Crimes against humanity'
Legal problems can come from several fronts.
A Brazilian Senate committee has recommended charges over Bolsonaro's management of the COVID-19 pandemic, including "crimes against humanity."
The COVID-denying Bolsonaro, who punted unproven cures and said vaccines could turn people into "alligators," is also being investigated for allegedly failing to act on an embezzlement tip-off regarding coronavirus vaccine purchases.
Another probe is pending into claims that Bolsonaro leaked a classified police investigation into corruption accusations against his sons, and interfered in another.
The outgoing president was further implicated in a probe into his senator son Flavio for an alleged scheme to collect part of political staffers' salaries in a practice known as "rachadinha".
That case was scrapped on the grounds that Bolsonaro junior enjoyed parliamentary immunity.
Bolsonaro has consistently denied any wrongdoing, claiming he is the victim of political persecution.
"They are looking for a way to get at me," he said after the online news site Uol published claims 30 days before the election, that his family members had bought 51 properties.
The properties were paid partly or fully in cash for a total of some $4.7 million between 1990 and 2022, with questions raised over the provenance of the money.
There were also claims of public money being abused on his watch to curry favor with evangelical leaders.
"When his presidential term ends, Jair Bolsonaro will be answerable to justice and the public prosecutor's office will be able to open new investigations," legal expert Rogerio Dultra dos Santos of Fluminense Federal University told AFP.
Bolsonaro was elected on an anti-corruption platform at a time when the country was reeling from a massive graft scandal involving state oil company Petrobras, Lula's government and his Workers' Party (PT).
Lula's own convictions in relation to that scandal were later annulled.
'Several years'
Lula has vowed to grant access to possibly compromising documents, both official and personal, that Bolsonaro had sealed for 100 years before leaving office.
This "could have legal consequences," said Dos Santos.
However, any attempt to bring Bolsonaro to justice could "take several years" considering the likelihood of multiple appeals along the way, the analyst added.
Ironically, Bolsonaro could benefit from a Supreme Court ruling that allowed Lula's release from prison in November 2019 pending an appeal against his corruption conviction.
Temporarily changing gear from his previous insistence that Lula would never win the election, Bolsonaro recently said he would "stay out of politics" if he loses.
But Mayra Goulart, a political scientist at the Federal University of Rio de Janeiro, said she would be "very surprised" if this were true.
Lawmakers and various other public servants in Brazil enjoy immunity from prosecution while in office.
Whatever his legal fate, Goulart said Bolsonaro would likely follow a similar path as his political idol, Donald Trump, "who maintains a considerable influence on American politics despite his 2020 defeat."