OUAGADOUGOU, Burkina Faso (AP) -- More than a dozen mutinous soldiers declared Monday on state television that a military junta now controls Burkina Faso after they detained the democratically elected president following a day of gunbattles in the capital.

The military coup is the third of its kind in West Africa in the last 18 months, creating upheaval in some of the countries hardest hit by Islamic extremist attacks.

Capt. Sidsore Kaber Ouedraogo said the Patriotic Movement for Safeguarding and Restoration “has decided to assume its responsibilities before history.” The soldiers were putting an end to Kabore's presidency because of the deteriorating security situation amid the deepening Islamic insurgency and the president's inability to manage the crisis, he said.

It was not immediately known where President Roch Marc Christian Kabore was, and the junta spokesman said only that the coup had taken place “without any physical violence against those arrested, who are being held in a safe place, with respect for their dignity.”

A soldier in the mutiny, who spoke on condition of anonymity due to the sensitivity of situation, told The Associated Press that Kabore had submitted his resignation.

The new military regime said it had dissolved Burkina Faso's constitution and National Assembly. The country's borders also have been closed, and a curfew will be in effect from 9 p.m. to 5 a.m.

Ouedraogo said that the country's new leaders would work to establish a calendar “acceptable to everyone” for holding new elections without giving further details.

The announcement on state broadcaster RTB capped a day of confusion over who was in control of Burkina Faso, once a bastion of stability in the region that has faced growing violence from Islamic extremists during Kabore's time in power.

In a statement, Kabore's political party accused the mutinous soldiers of trying to assassinate the president and another government minister and said the presidential palace in Ouagadougou remained surrounded by “heavily armed and hooded men.”

“The army's coup is a signal of frustration and exasperation on the heels of a growing struggle to stem the threat of militants, cope with the degraded security structure, and an attempt to restore faith in the institution of the military,” said Laith Alkhouri, CEO of Intelonyx Intelligence Advisory, which provides intelligence analysis.

Gunfire erupted early Sunday when soldiers took control of a major military barracks in the capital, Ouagadougou. In response, civilians rallied in a show of support for the rebellion but were dispersed by security forces firing tear gas. On Monday, groups of people celebrated again in the streets of the capital after reports of Kabore's capture.

Kabore was elected in 2015 after a popular uprising ousted longtime strongman President Blaise Compaore. Kabore was reelected in November 2020, but frustration has been growing at his inability to stem the spread of jihadist violence across the country. Attacks linked to al-Qaida and the Islamic State group are escalating, killing thousands and displacing more than an estimated 1.5 million people.

The military has suffered losses since the extremist violence began in 2016. In December, more than 50 security forces were killed and nine more died in November.

Mutinous soldiers told the AP that the government was out of touch with troops and that they wanted military rule. Among their demands are more forces in the battle against extremists and better care for the wounded and the families of the dead.

About 100 military members have planned the takeover since August, according to one of the mutinous soldiers. Discontent among the population also has been growing, with a demonstration calling for Kabore's resignation held the day before the army launched its mutiny.

“People are tired with this situation of insecurity. Every day, people are killed. In Burkina, there are areas that can't be accessed. We have lost a big part of our territory,” said Jean-Baptiste Ilboudou, a civilian who was biking near the military base when gunshots were heard.

The West African regional bloc known as ECOWAS, which already has suspended Mali and Guinea in the past 18 months over military coups, issued a statement of support for Burkina Faso's embattled president and urged dialogue with the mutineers.

Burkina Faso has also seen its share of coup attempts and military takeovers - though it experienced a period of relative stability under Compaore, who ruled for 27 years until his ouster in 2014.

Earlier this month, authorities arrested a group of soldiers accused of participating in a foiled coup plot. It was not immediately known whether there was any connection between those soldiers and the ones rebelling now. Military prosecutors said nine soldiers and two civilians were being held in connection with the plot.

In 1987, Compaore came to power by force. And in 2015, soldiers loyal to him attempted to overthrow the transitional government put into place after his ouster. The army was ultimately able to put the transitional authorities back in power, who led again until Kabore won an election and took office.