Zimbabwe's military has placed President Robert Mugabe under house arrest in the capital Harare, South African President Jacob Zuma says.
Mugabe told 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 Mugabe with his sacked deputy, Emmerson Mnangagwa, BBC correspondents say.
Mnangagwa's dismissal last week left Mugabe's wife Grace as the president's likely successor.
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 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 Mugabe and a number of government officials live.
In a statement, 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
At heart is a power struggle over who succeeds Mugabe. The rivalry between his wife Grace and Mnangagwa has split the governing Zanu-PF.
Following a call from Mrs Mugabe, 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.
Gen Chiwenga is a close ally of 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.
An extraordinary gamble
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 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.
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 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.
"I want to thank the general for removing this tyrant," said a man. "He was ruling the country as if it belonged to his family."
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.