Pierre Nkurunziza has said he has returned to Burundi on the country's presidential Twitter site, after the army chief declared that an attempted coup staged when the east African leader was abroad had failed.

Nkurunziza had been in Tanzania when the coup began on Wednesday but his presence in the country could not be independently verified. The office of the president later tweeted that Nkurunziza would address the nation later on Friday.

Bursts of gunfire in the capital and fighting for control of the state radio during the day indicated there was still determined opposition to the president, who sparked protests and the coup attempt by his move to seek a third term.

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.

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 in 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.

'Our movement has failed'

Speaking on Thursday to the AFP news agency, deputy coup leader General Cyrille Ndayirukiye said: "Personally, I recognise that our movement has failed.

"We were faced with an overpowering military determination to support the system in power."

Nkurunziza was in Tanzania at a summit of African leaders when Major General Godefroid Niyombare, who the president sacked as intelligence chief in February, declared he was dismissing the president and his government.

A day later, 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.

A Reuters witness saw one dead soldier lying near the Interior Ministry. Nearby troops said he was a coup supporter.

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 is coming home 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.

UN condemnation

The UN Security Council has condemned both those behind the coup attempt and Nkurunziza.

In a unanimous statement on Thursday, the 15-member council said it condemned both those who "facilitate violence" against civilians and those who seek to seize power by unlawful means.

The Security Council has been divided on how to address the Burundi crisis, with Russia and China arguing that the dispute over Nkurunziza's bid for a third term is a constitutional matter that should be resolved internally.

In its statement, the council called for "the swift return of the rule of law, and the holding of credible elections".

Source: Al Jazeera and agencies