A Burundian general said on Wednesday he had deposed President Pierre Nkurunziza for seeking an unconstitutional third term in office and was forming a transitional government, after more than two weeks of protests against the election bid.
But as cheering crowds streamed onto the streets of Bujumbura, sporadic gunfire was heard in the centre of the capital, and it was not immediately clear how much support Major General Godefroid Niyombare had.
With Nkurunziza abroad at an African summit to discuss the crisis, the presidency rubbished the declaration by Niyombare, who had been fired as Nkurunziza's intelligence chief in February, saying on Facebook that the coup had been "foiled".
"We consider it as a joke, not as a military coup," presidential aide Willy Niyamitwe told Reuters East African leaders meeting in Tanzania condemned the attempt to oust the president and called for a return to the "constitutional order".
A Tanzanian official said Nkurunziza had not attended the meetings, and had left to return to Burundi.
Niyombare said the capital's airport and all border crossings were closed.
Activists say more than 20 people have been killed in weeks of protest against Nkurunziza's re-election bid, plunging Burundi into its worst crisis since an ethnically fuelled civil war ended in 2005.
More than 50,000 Burundians have fled to neighbouring states in a region with a history of ethnic fighting.
"The region will not accept, nor will the region stand by, if violence does not stop or escalates in Burundi," Tanzanian President Jakaya Kikwete said after the summit in Dar es Salaam.
It was not immediately clear who was in control in Burundi. The state broadcaster, often a primary target in state takeovers in Africa, was surrounded by troops. An employee inside told Reuters some soldiers had tried to enter while others resisted.
That did not deter crowds dancing and singing in the streets. Some sat on top of cars. A Reuters correspondent saw little sign of the police, hated by protesters for breaking up demonstrations by force and widely considered loyal to Nkurunziza's party.
Niyombare had made his declaration that Nkurunziza was overthrown to reporters at a barracks in Bujumbura.
"Regarding President Nkurunziza's arrogance and defiance of the international community, which advised him to respect the constitution and Arusha peace agreement, the committee for the establishment of the national concord decide: President Nkurunziza is dismissed, his government is dismissed too," he said, surrounded by several other senior army and police officers, including a former defence minister.
It was not clear if the army was fully under Niyombare's command. In the 12-year war, the formerly Tutsi-led army fought rebel groups from the Hutu majority, including one commanded by Nkurunziza. The military is now officially mixed, and has become a symbol of reconciliation, but the presence of rival factions creates possible faultlines.
Many Tutsis say the Imbonerakure youth wing of Nkurunziza's ruling party has been armed and has been threatening Tutsis. The US government has also voiced concern about militias beingarmed. The ruling party has denied all the allegations.
Diplomats in New York said the United Nations Security Council would discuss Burundi during a monthly lunch with Secretary-General Ban Ki-moon on Wednesday. Ban himself called on all parties to exercise calm and restraint.
Opponents say Nkurunziza's bid for another five years in office violates a two-term limit set down in the constitution and in the Arusha peace deal that ended the civil war.
A constitutional court, however, ruled that the president could run, finding that his first term, when he was picked by parliament rather than by popular vote, did not count. Critics say the court is biased.
Niyombare, also a former ambassador to Kenya, said he was working with civil society groups, religious leaders and politicians on forming a transitional government.
Western donors, including the United States and the European Union, have criticised Nkurunziza's decision to stand again.
The European Union and Burundi's former colonial ruler Belgium had said they were suspending some aid, particularly support for the elections, due to the violence. Belgium had no immediate comment on the statement from the general.