Gabon has foiled an attempted military coup, killing two suspected plotters and capturing seven others just hours after they took over state radio in a bid to end 50 years of rule by President Ali Bongo's family.

Guy-Bertrand Mapangou, spokesman for the government, announced the deaths and arrests on Monday after soldiers briefly seized the radio station in the capital, Libreville, and broadcast a message saying Bongo was no longer fit for office.

The 59-year-old president, who suffered a stroke in Saudi Arabia in October, has been in Morocco for medical treatment since November.

On December 31, in one of his first television appearances since the stroke, Bongo, slurred his speech and he appeared unable to move his right arm. It is unclear if he is able to walk.

In a radio message at 4:30am (3:30 GMT), Lieutenant Kelly Ondo Obiang, who described himself as an officer in the Republican Guard, said Bongo's New Year's Eve address "reinforced doubts about the president's ability to continue to carry out of the responsibilities of his office".

A video posted on social media shows Ondo wearing military fatigues and a green beret as he reads the statement. Two other soldiers with rifles stand behind him.

Ondo said the coup attempt was by a group called the Patriotic Movement of the Defence and Security Forces of Gabon, who wanted to "restore democracy" in the oil-rich West African nation.

Outside the radio station, about 300 people gathered in support of the coup attempt, but were quickly dispersed by loyalist soldiers.

Later, security forces stormed RTG state broadcasting headquarters, capturing the rebel chief, killing two of his team and freeing journalists and technicians who had been held hostage and forced to help the mutineers make their broadcast, the presidency said in a statement.

"The situation is under control," the statement said.

"The government is in place. The institutions are in place," Mapangou told France 24.

Curfew

A curfew has been imposed over the beachside capital and the internet has been cut, according to residents. Military tanks and soldiers were patrolling the streets, said Antoine Lawson, a Gabonese journalist.

Speaking to Al Jazeera from Libreville, Lawson said the coup attempt had caused widespread panic.

"The people are afraid. When the young soldiers asked everyone to come to the streets in support of the coup, nobody did, because they were in panic," he said.

Mehari Taddele Maru, a Kenya-based security consultant, told Al Jazeera the coup attempt showed growing frustration with the Bongo family, which has ruled the oil-producing country since 1967.

Bongo has been president since succeeding his father, Omar, who died in 2009.

"As long as Gabon remains under dynastic rule, there will be more crises," said Mehari.

Critics have accused the Bongo family of profiting from the country's natural resources while not investing enough in basic services for the population of more than two million.

About one-third of the population lives below the poverty line, according to the World Bank.

Bongo was narrowly re-elected in 2016 following a presidential poll marred by deadly violence and allegations of fraud.

After he fell ill, the Constitutional Court modified the constitution and transferred part of the powers of the president to the prime minister and the vice president, a move the rebels attacked as "illegitimate and illegal".

'Everything is in crisis'

Marie-Roger Biloa, editor of Africa International, said the court's move was seen as a ploy by the "Bongo clan to retain power over the country".

"The main reason for [the attempted coup] goes back to 2016, when there was a rigged election, and nothing happened and Ali Bongo got away with it," she told Al Jazeera from Paris.

"He's been a catastrophic leader, enjoying travelling all over the world, while letting the country go down the drain, everything is in crisis - education, healthcare - and the young people want to do something about it."

The African Union and France strongly condemned the attempted coup and warned against any "unconstitutional" change of power in Gabon.

190107071230267

"The African Union strongly condemns the coup attempt this morning in Gabon," the head of the African Union Commission, Moussa Faki Mahamat, said on Twitter. "I reaffirm the AU's rejection of all anti-constitutional change."

Agnes von der mull, a spokeswoman for the French foreign ministry, condemned "any extra-constitutional attempt at regime change".

France, which ruled Gabon from 1885 until independence in 1960, has a permanent force of 300 soldiers in Gabon.

The United States also sent about 80 soldiers to Gabon last week in response to possible violence in the Democratic Republic of Congo after a presidential election there.