A South African court has ruled that the country's former President Jacob Zuma should be returned to prison, saying his medical parole was "unlawful".
The time he has spent out of prison should not be counted in his 15-month sentence, the Pretoria court ruled.
Zuma was released on 5 September for an undisclosed medical condition.
He had been jailed for failing to attend an inquiry into corruption during his presidency.
The 79-year-old handed himself in to police in July after a public stand-off, but his jailing, unprecedented for an ex-president, sparked violent protests and looting.
More than 300 people, mostly in Zuma's stronghold of Kwa-Zulu Natal province, died in the protests.
The former leader had testified only once at the inquiry into what has become known as "state capture" - meaning the siphoning off of state assets.
Businessmen have been accused of conspiring with politicians to influence the decision-making process while he was in office. Zuma has repeatedly said he is the victim of a political conspiracy.
Prison authorities say his release on parole was compelled by a medical report, but what ails him has never been disclosed.
He did, however, undergo surgery after he was imprisoned.
The former president's spokesman said at the time that imprisonment had had "an exponential impact in terms of deteriorating his condition". His lawyers also argued that their client's illness had rendered him incapacitated.
South Africa's main opposition party, the Democratic Alliance, said the parole was entirely unlawful and made a mockery of prison regulations.
On Wednesday, judges in the High Court in Pretoria ruled that the decision by the top correctional officer to release Zuma on medical parole was "reviewed, declared unlawful, and set aside".
Zuma is expected to appeal the decision.
line
Zuma's legal woes:
2005: Charged with raping family friend - acquitted in 2006
2005: Charged with corruption over multi-billion dollar 1999 arms deal - charges dropped shortly before he becomes president in 2009
2016: Court orders he should be charged with 18 counts of corruption over the deal - he appeals, but in 2017 loses a bid to overturn them
2016: Court rules he breached his oath of office by using government money to upgrade private home in Nkandla - he repays the money
2017: Public protector says he should appoint judge-led inquiry into allegations he profiteered from relationship with wealthy Gupta family - he denies allegations, as do the Guptas
2018: Zuma approves inquiry into claims of state looting
2018: The National Prosecuting Authority confirms Zuma will face prosecution for 12 charges of fraud, one of racketeering, two of corruption and one of money laundering, relating to the arms deal, which he denies
2021: Begins a 15-month jail sentence after the Constitutional Court orders his arrest for refusing to testify at the commission into state looting