South Africa's highest court has barred former President Jacob Zuma from running for parliament in next week's general election.
The Constitutional Court ruled that his 15-month prison sentence for contempt of court disqualified him.
Mr Zuma was convicted in 2021 for refusing to testify at an inquiry investigating corruption during his presidency which ended in 2018.
He has been campaigning under the banner of the newly formed uMkhonto weSizwe (MK) party after falling out with the governing African National Congress (ANC).
MK secretary general Sihle Ngubane said the party was disappointed with the ruling, but it would not affect the party's campaign for the 29 May election.
"He is still the leader of the party. It [the ruling] doesn't affect our campaign at all," he said.
South Africans vote for political parties, with the candidates at the top of their lists getting parliamentary seats depending on the number of votes the party gets.
The electoral commission said Mr Zuma's name would now be removed from MK's list of parliamentary candidates, while confirming that his image would remain on ballot papers, alongside his party's logo.
MK members sang and danced outside the court portraying Mr Zuma as a victim, while those inside - some dressed in traditional Zulu regalia - sat silently as Justice Leona Theron read out the unanimous judgement.
Mr Zuma has not yet commented on the ruling.
His supporters rioted after he was sent to jail in 2021, and some of its leaders had threatened violence if the court disqualified him from standing for parliament.
But MK officials have since changed their rhetoric, saying the party's focus was on getting a two-thirds majority so that South Africa's constitution could be changed, and Mr Zuma could be returned to power.
In court, his lawyers had argued that because he was released after three months in prison by his successor, President Cyril Ramaphosa, the rest of his sentence was cancelled.
But the court disagreed, saying the length of time he actually spent in prison was irrelevant.
South Africa's constitution barred anyone sentenced to 12 months in prison, without the option of a fine, from serving in parliament in order to protect the integrity of the "democratic regime" established after the end of the racist system of apartheid in 1994, Justice Theron said.
Mr Ramaphosa told a local radio station that he "noted" the ruling.
"The court has ruled, and as I have often said, that is the highest court in the land and we have given the judiciary the right to arbitrate disputes amongst us in terms of our constitution," he said in an interview with 702.
Political analyst Levy Ndou told the BBC that the ruling had the "potential to test his [Mr Zuma's] character - whether he joined the party for selfish reasons or whether he joined it to take South Africans forward".
The ruling could weaken MK's chances in the election if its members joined the party out of loyalty to a "single individual", but if they genuinely believed in its cause then they "would have to focus the activities of the party without him", he added.
MK has been plagued by in-fighting since last month, with Mr Zuma rising to the helm of the party after ousting its founding leader, Jabulani Khumalo. He insists he is still the leader of the party.
Mr Ramaphosa ousted Mr Zuma as president in 2018 after a vicious power struggle, and is leading the ANC's campaign to extend its 30-year rule.
Mr Zuma's removal was welcomed by many South Africans as his nine years in office were marred by widespread allegations of corruption, which he has always denied.
The former president said last December that he could never vote for a party led by Mr Ramaphosa and has spearheaded MK's campaign. This will be the first election that it will contest after it was registered as a party last September.
The party's emergence has raised the prospect that the ANC could lose its parliamentary majority for the first time in 30 years ago.
MK's support is mainly in Mr Zuma's home province of KwaZulu-Natal, and the economic heartland, Gauteng.
These two provinces have the highest number of registered voters, and have been the main battleground in the election.
South Africans will be voting for the national parliament, and nine provincial legislatures.
The president is elected by the new parliament, while each legislature elects a provincial premier.
The court's ruling bars Mr Zuma from taking up a seat in parliament or any of the provincial legislatures.
An Ipsos opinion poll released last month gave MK 8% of the vote, and the ANC 40% as it loses support to MK and other opposition parties.
But some analysts suggest that with the governing party stepping up its campaign in recent weeks, it could still cross the 50% mark.
The ANC got 57.5% in the 2019 election.
Former President Thabo Mbeki, who remains popular among many voters, recently joined the ANC's campaign in KwaZulu-Natal and Gauteng, denouncing Mr Zuma as a "wolf in sheep's skin" and a "counter-revolutionary".
uMkhonto we Sizwe, which roughly translates as Spear of the Nation, is the original name of the ANC's armed wing, which fought apartheid.