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.
Heavy gun and artillery fire could be heard in northern parts of Harare early on Wednesday.
Mr Mugabe, 93, has dominated the impoverished country’s political scene since it gained independence from the UK in 1980.
The UK Foreign Office advised Britons “currently in Harare to remain safely at home or in their accommodation until the situation becomes clearer”, while the US embassy in Harare advised US citizens in Zimbabwe to “shelter in place” until further notice.
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.
What do we know of Mr Mugabe’s situation?
The firing heard during the early morning came from Harare’s northern suburbs, where Mr Mugabe and a number of government officials live, the BBC’s Shingai Nyoka reports from Harare.
Special envoys from the Southern African Development Community would be sent to Zimbabwe, he added.
A Zimbabwean army officer, Major General Sibusiso Moyo, went on TV after the takeover to say Mr Mugabe and his family were “safe and sound and their security is guaranteed”.
How did the military justify its move?
“We are only targeting criminals around him who are committing crimes… that are causing social and economic suffering in the country,” Maj Gen Moyo said, reading out a statement.
“As soon as we have accomplished our mission, we expect that the situation will return to normalcy.”
Maj Gen Moyo also called on the security services to co-operate “for the good” of the country and warned that any provocation would “be met with an appropriate response”.
It is not clear who is leading the military action.
Army chief Gen Constantino Chiwenga, who visited China last week, said on Monday the army was prepared to act to end purges within the ruling Zanu-PF party.
In Harare, some people greeted the news with delight. “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.”
An extraordinary gamble
By Andrew Harding, BBC Southern Africa correspondent
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.
Has anyone else been detained?
A government source told Reuters news agency that Finance Minister Ignatius Chombo was being held.
He is a leading member of a Zanu-PF faction led by Grace Mugabe, 52.
What was the political situation before the army acted?
The rivalry between Mrs Mugabe and Mr Mnangagwa has split Zanu-PF.
Gen Chiwenga is a close ally of Mr Mnangagwa and both are veterans of the 1970s war which ended white minority rule.
The leader of the war veterans, Chris Mutsvangwa, welcomed the military move, telling Reuters news agency: “This is a correction of a state that was careening off the cliff.
“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.”