An attempted military coup in the African nation of Gabon was foiled early Monday after several alleged plotters were arrested and two others were killed, a government official said.

Five junior army officers took over control of the state broadcasting officers and a major thoroughfare in the capital city of Libreville early Monday in the coup attempt.

Quick action by security forces foiled the coup and five of the plotters were arrested, government spokesman Guy-Bertrand Mapangou, told Radio France International.

He said President Ali Bongo’s government remains in control and that “situation is calm.”

CLICK HERE TO GET THE FOX NEWS APP

“The gendarmes who are often stationed [in Libreville] have taken control of the entire area around the radio and TV headquarters, so everything is back to normal,” Mapangou told the BBC.

Earlier Monday, a soldier who identified himself as Lt. Obiang Ondo Kelly, commander of the Republican Guard, read out a statement saying the military had seized control of the government in the West African country and called on people to “rise up.”

He was flanked by two other soldiers holding weapons and dressed in camouflage uniforms and green berets. Two more soldiers were involved in taking control of the national radio station.

The soldiers said they launched a coup in a bid to “restore democracy” to the country.

A curfew has been imposed over the capital and the internet has been cut. The city on the Atlantic Ocean coast is being patrolled by military tanks and armed vehicles.

On Monday, the African Union chief Moussa Faki condemned the attempted coup in a tweet and reaffirmed the union’s “total rejection of all unconstitutional change of power.”

The attempted coup came as a surprise as the military has supported Bongo’s presidency since he took power in 2009. The president has been out of the country since October amid reports he had a stroke. He recently addressed the country in a New Year’s message that was filmed in Morocco, where he has been receiving medical treatment.

WATER ACTIVIST DROPS BID TO FINISH 100 MARATHONS IN 100 DAYS

Oil-rich Gabon has been ruled for more than half a century by Bongo and his father, Omar, who died in 2009. Critics have accused the family of profiting from the country's natural resources while not investing enough in basic services for the population of more than 2 million.

In his brief New Year's speech, the 59-year-old Bongo declared that the country was "indivisible" and acknowledged his health problems without giving details. "A difficult period," he called it, and a challenge that he surmounted "thanks to God." He promised to put all of his efforts into improving the daily quality of life for Gabon's people.

The French-educated Bongo, who was the country's defense minister before becoming president, narrowly won re-election in 2016 while opposition rival Jean Ping claimed irregularities and continues to call himself the country's real president.

The Associated Press contributed to this report.