Jacob Zuma, South Africa's scandal-hit president, may not see out his second term now that the governing African National Congress (ANC) party has elected Cyril Ramaphosa its leader.

For the last few years Mr Ramaphosa has been Mr Zuma's deputy, but their relationship has been an uneasy one.

Mr Ramaphosa ran on an anti-corruption ticket, and many believe this means he is much more likely to make sure allegations of corruption against Mr Zuma are pursued.

Here are a few ways things may play out ahead of general elections in 2019:

1. Zuma is fired

The ANC will want to avoid two competing centres of power - with rival leaders holding the posts of president of the party and president of the country.

So it may choose to sack Mr Zuma as president of the country, seeing him as a political liability in the run-up to the election.

This would open the way for Mr Ramaphosa to take power and try to regain the confidence of voters amid fears that the ANC's 62% majority is under serious threat.

But it would be a risky move as it could split the party.

Some powerful allies of Mr Zuma, including the new ANC deputy president and secretary-general, may resist moves to sack him.

It would not be the first time a president has been fired - it happened to Thabo Mbeki in 2008 after he lost the ANC leadership to Mr Zuma.

The decision to sack Mr Zuma would be made by the ANC's National Executive Committee (NEC), which is its highest decision-making body.

One of the NEC's members would need to table a motion to "recall" him as president of the country.

The NEC's members, who number more than 100, would then vote on it or reach a consensus decision.

The party is due to vote in new NEC members at the ANC conference, which ends on Wednesday - so whether those chosen are supporters of Mr Zuma is likely to have a bearing on this.

It is impossible to predict when a "recall" might happen, but some analysts think the ANC might want to have Mr Zuma out of office by the time of the annual State of the Nation address in February.

However, political analyst Somadoda Fikeni thinks it may happen much later, when Mr Zuma's leadership becomes untenable.

President Zuma's legal woes are likely to come to a head later in 2018, he says.

These include:

The possibility that 18 charges of corruption, stemming from an arms deal in the late 1990s, could be reinstated.

The prospect of an inquiry into so called "state capture" - the allegation that a wealthy Indian family - the Guptas- has influenced government through a corrupt relationship with Mr Zuma. Both Mr Zuma and the Guptas deny the allegations.

Mr Fikeni says the ANC leadership knows that Mr Zuma is "not the kind to bow out without a fight. He would be prepared to bring the ANC down in flames".

The start of the state capture commission, and other legal processes against might force the issue.

2. Zuma steps down

Another possibility Mr Fikeni points to is that the ANC leadership might convince Mr Zuma to resign.

ANC leaders "do understand the political cost of Zuma, who will be in and out of courts" over the next year, he says.

"That in itself will be a death knell in 2019 [ahead of elections]," he adds.

Instead the leadership is "likely to talk to [Mr Zuma] nicely, and appeal to him to step down", says Mr Fikeni.

"If he resists, a 'recall' might become inevitable."

3. Zuma remains in office

Then there are those who argue that it would be unwise for Mr Ramaphosa to try and sack Mr Zuma because it could fracture the party even further, and detract from what the real focus should be: Preparing to fight the 2019 election.

Instead, they say that Mr Ramaphosa would be better advised to allow Mr Zuma to become tied up in his legal woes, effectively neutralising him.

The South African judiciary is robust and independent, and has put high-profile political figures in prison before.

Some analysts believe Mr Zuma will be far too busy dealing with his own legal problems to cause any real threat to Mr Ramaphosa.

Proponents of this scenario say it would leave Mr Ramaphosa free to focus on the real issues that will affect the forthcoming general election:

Uniting the governing party, which has become bitterly fractured over the leadership bid

Convincing ordinary South Africans that the ANC can still represent their interests.