A coup against Burundi President Pierre Nkurunziza appears to have failed as he returned to the country on Thursday 14 May, his office said.
However, bursts of gunfire in the capital Bujumbura and fighting for control of the state radio during the day indicated there was still determined opposition to the president.
Protests and the attempted coup by Major General Godefroid Niyombare, whom the president sacked as intelligence chief in February, were sparked when Nkurunziza said he would seek a third term as head of the east African state.
Critics said his re-election bid violated the constitution and a peace deal that ended an ethnically fuelled civil war that ended in 2005, plunging the nation into a deep political crisis.
But before announcing his return, loyalists of the president said they were in control of the major strategic assets, such as the airport and presidential offices. They also said they still controlled the state broadcaster despite the heavy fighting.
"President Nkurunziza is back in Burundi after the attempted coup. He congratulates the army, the police and the Burundian people," said a brief phone text message from the presidency.
A presidential official confirmed the statement, but would not say where Nkurunziza was in Burundi or how he had returned.
Nkurunziza was in Tanzania at a summit of African leaders when Niyombare declared he was dismissing the president and his government.
On 14 May, Army Chief of Staff General Prime Niyongabo said the coup had failed. "Loyal forces are still controlling all strategic points," he said in a state radio broadcast.
The announcement of Nkurunziza's return suggested the government was now back in effective control, although periods of relative calm in Bujumbura were broken by bouts of gunfire. By evening, the city had a semblance of calm, said Reuters.
In an earlier broadcast, Nkurunziza offered amnesty to rebel troops. "I thank soldiers who are putting things in order, and I forgive any soldier who decides to surrender," he said.
But he has returned to a nation where thousands of people in the capital spent more than two weeks protesting against his third-term election bid, often waging fierce street battles with police, and then cheered when his ouster was announced.
Nkurunziza justifies his bid for another five years in office by pointing to a constitutional court ruling which said the president could run because his first term, when he was picked by parliament rather than by popular vote, did not count. Critics say the court is biased.
Burundi's army is a symbol of national reconciliation but it has displayed alarming rifts.
In the civil war, the army was commanded by minority Tutsis who fought rebel groups of the majority Hutus, including one led by Nkurunziza. Now the military is a mixed ethnic force and has absorbed rival factions.
But the coup attempt suggested divisions in the ranks remain just below the surface, threatening a return to ethnic blood-letting that has worried Burundi's neighbours.
The United Nations says more than 70,000 Burundians have fled the country for fear of an upsurge in violence, unsettling a region with a history of ethnic fighting.
African nations condemned the takeover attempt. "East African leaders are determined to find a lasting solution to Burundi's crisis," Tanzanian Foreign Minister Bernard Membe said in Dar es Salaam. "Africa does not want the leadership of any country to be assumed by the barrel of a gun."
After Wednesday's coup attempt, the United States, which helps train and equip the army, told all sides to end violence.
The European Union, Belgium and the Netherlands have all suspended some aid due to the unrest, particularly donations linked to the elections, which include parliamentary polls scheduled for 26 May and the presidential vote on 26 June.