At least three people have been killed and 60 injured during street clashes in Burkina Faso’s capital as protesters demonstrated against a military coup, a senior source in the main hospital has said.

Witnesses said that soldiers fired warning shots on Thursday to disperse crowds gathering in the streets of Ouagadougou, who responded by throwing stones.

The military had taken to the airwaves earlier on Thursday to declare it now controlled the country, confirming that a coup has taken place on Wednesday – just weeks before national elections.

Ban Ki-moon, UN secretary-general, called for the country’s military to “exercise restraint”.

Ban condemned “in the strongest terms” the coup led by a close ally of toppled former leader Blaise Compaore.

“Those responsible for the coup d’etat and its consequences must be held accountable,” he said in a statement.

In a statement, Susan Rice, the US national security adviser, said: “We call on the responsible parties to release immediately those being detained, order aligned forces to stand down, respect the rights of civilians to peacefully assemble, and put Burkina Faso back on the path to presidential elections in October.

“We are deeply disappointed that the self-interested actions of a few are threatening the historic opportunity that the people of Burkina Faso have to cast their ballots and build a new future for the country.”

The statements came a day after members of the elite presidential guard unit of the military arrested the transitional president and prime minister.

A communique read by Lieutenant Colonel Mamadou Bamba criticised the electoral code, which blocked members of the former president’s party from taking part in the October 11 elections.

Anyone who supported the former president’s bid to amend the

constitution so he could seek another term is also banned from running.

Bamba on Thursday announced the beginning of a “coherent, fair and equitable process” that would lead to inclusive elections. The power grab violates the country’s constitution.

Burkina Faso was due to hold elections on October 11 that many hoped would strengthen democracy.

Cynthia Ohayon, West Africa analyst with International Crisis Group (ICG), described the turn of events as “unsurprising”.

“It is still very unclear how this crisis will now resolve itself […] the only outcome will come through negotiation and compromise [but] I don’t see what sort of of compromise will be acceptable to both sides, considering both sides have gone all in so far,” Ohayon told Al Jazeera from Paris.

The transitional government came to power after the president for 27 years, Blaise Compaore, was toppled late last year in a public uprising.