BUJUMBURA, Burundi - 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 re-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 having gone to Tanzania to discuss the crisis with East African leaders, the presidency dismissed 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. But late on Wednesday night, Nkurunziza's whereabouts were unclear.
A Tanzanian official said he had not attended the talks in Dar es Salaam, and had left to return to Burundi. But Niyombare said the capital's airport and all border crossings were closed.
The East African leaders condemned the bid to oust him and called for a return to "constitutional order".
The US State Department urged "all parties to immediately end the violence and exercise restraint". But spokesman Jeff Rathke said he could not confirm that a coup had taken place.
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.
The United Nations said more than 70,000 Burundians had 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.
It was hard to establish 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 from 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 had been 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 being given weapons. The ruling party has denied all the allegations.
Diplomats in New York said the United Nations Security Council discussed 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.