Celebrations have broken out in Burundi's capital Bujumbura following a coup against the government of President Pierre Nkurunziza.

The developments came after an army officer announced on Wednesday that Nkurunziza and his government had been dismissed hours after he left for neighbouring Tanzania for regional talks.

Major-General Godefroid Niyombare, who was fired by Nkurunziza as intelligence chief in February, made the announcement at a military barracks, reports said.

He was surrounded by several other senior officers from the army and police, Reuters news agency reported.

"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," Niyombare was quoted as saying.

The Tanzanian government said Nkurunziza was flying back home, although his exact whereabouts on Wednesday night were unclear, amid speculation he may have travelled to a third country elsewhere in the region.

Huge celebrations

Al Jazeera's Malcolm Webb, reporting from Bujumbura, spoke of huge celebrations and some gunfire, although it was not immediately clear if the shots were being directed at the demonstrators or were celebratory in nature.

About 20 soldiers were deployed at the gate of the compound of the broadcaster in Bujumbura, he said.

"The road outside has been sealed off and journalists have been told to go inside," he said, adding that state radio and TV were still broadcasting.

It appears that the army has control of the state broadcaster and state-owned buildings, he said.

The army are setting up barricades off Chausée Prince Louis Rwagasore. Présidence, Ministers' houses... #Burundi pic.twitter.com/Im8kH9ZiUQ — Pádraic (@kudupadraic) May 13, 2015

While in Tanzania, Nkurunziza was due to meet the leaders of the five-nation East African Community (EAC) - made up of Kenya, Rwanda, Tanzania and Uganda as well as Burundi.

The president's office, in a message posted on Twitter, said an attempted coup had "failed".

"The situation is under control, there is no coup in Burundi," the message read.

A presidential adviser dismissed the news of the coup as "a joke", Reuters reported.

Agathon Rwasa, a leading Burundian opposition figure, told Al Jazeera he supported the move by military officials to remove Nkurunziza.

"I think it's right to rescue the people and the nation ... Nkurunziza is relying on his militia to slaughter innocent people," Rwasa said.

At least 19 people have died in Burundi since Nkurunziza announced his intention to run for a third term in elections due next month, prompting weeks of angry demonstrations.