Zimbabwe’s military has placed President Robert Mugabe under house arrest in the capital Harare, South African President Jacob Zuma says.
Mr Mugabe told Mr Zuma in a phone call that he was fine, the South African leader’s office said.
Troops are patrolling the capital, Harare, after they seized state TV and said they were targeting “criminals”.
The move may be a bid to replace Mr Mugabe with his sacked deputy, Emmerson Mnangagwa, BBC correspondents say.
Mr Mnangagwa’s dismissal last week left Mr Mugabe’s wife Grace as the president’s likely successor.
Mr Mugabe, 93, has dominated the country’s political scene since it gained independence from the UK in 1980.
How the drama unfolded
After days of tension and rumour, soldiers seized the state broadcaster ZBC late on Tuesday.
A Zimbabwean army officer, Major General Sibusiso Moyo, went on air and denied there was a coup, but said the military was targeting “criminals” around President Mugabe.
Maj Gen Moyo also said Mr Mugabe and his family were “safe and sound and their security is guaranteed”. It is not clear who is leading the military action.
Since then military vehicles have been out on the streets of Harare, while gunfire has been heard from northern suburbs where Mr Mugabe and a number of government officials live.
In a statement, Mr Zuma’s office said: “President Zuma spoke to President Robert Mugabe earlier today who indicated that he was confined to his home but said that he was fine.”
How we got here
Media captionWho is Grace Mugabe?
At heart is a power struggle over who succeeds Mr Mugabe. The rivalry between his wife Grace and Mr Mnangagwa has split the governing Zanu-PF.
Did Mugabe go too far?
Following a call from Mrs Mugabe, Mr Mnangagwa was removed from the vice-presidency earlier this month.
But on Monday, army chief Gen Constantino Chiwenga said the army was prepared to act to end purges within Zanu-PF.
Media captionWho is the “crocodile” and is he behind the military takeover in Zimbabwe?
Gen Chiwenga is a close ally of Mr Mnangagwa and both are veterans of the 1970s war which ended white minority rule.
One of the leading members of the Zanu-PF faction led by Grace Mugabe, Finance Minister Ignatius Chombo, is being detained, a government source told Reuters.
A quick show of military force, a few arrests… and then what?
These are, of course, unpredictable times for Zimbabwe and yet there is a chance that the army’s extraordinary overnight gamble will pay off, and that President Robert Mugabe, humiliated and powerless, will nonetheless be allowed to retire with at least the pretence of dignity.
It is important to remember that Mr Mugabe is not being challenged by the Western governments he has warned against for decades, or by Zimbabwe’s political opposition, or by a mass uprising against economic hardship.
This is, fundamentally, an internal power struggle within Zanu-PF and whoever emerges victorious can expect a newly purged party to fall obediently into line.
Mr Mugabe’s mistake, at 93, was to assume he was still powerful enough to build a dynasty to back his wife, Grace, to succeed him.
Instead, his once loyal deputy, Emerson Mnangagwa, may be poised to take control. If so, many foreign governments are likely to give him the benefit of the doubt and hope he can rescue Zimbabwe from years of misrule.
Is this a coup?
In his statement Maj Gen Moyo said “this is not a military takeover of government”.
But despite the Zimbabwean military’s denials, to many observers their actions bore many of the hallmarks of a coup.
There has been no direct comment from President Mugabe, nor his wife Grace, whose whereabouts are unclear.
Key regional blocs the African Union (AU) and the Southern African Development Community (SADC) do not look favourably on unconstitutional changes of power, which might explain the Zimbabwean military’s wording.
How can you tell a coup is happening?
How the news is being seen
In Harare, some were delighted. “We are going to have a good life, we are looking forward to Christmas, because of what has happened,” one woman told BBC News.
Media captionZimbabweans react to the news that troops had taken control
The leader of the war veterans, Chris Mutsvangwa, told Reuters: “It’s the end of a very painful and sad chapter in the history of a young nation, in which a dictator, as he became old, surrendered his court to a gang of thieves around his wife.”
Both the UK Foreign Office and US embassy in Harare has advised its citizens to remain indoors until the situation becomes clearer.
China, Zimbabwe’s biggest trading partner, says it is closely watching the situation and hopes that the relevant parties can properly handle their internal affairs.