OUAGADOUGOU, Burkina Faso — The military announced Monday that it had seized power in Burkina Faso, suspending the constitution and ousting the country’s democratically elected president hours after mutinous soldiers surrounded his home.

President Roch Marc Christian Kabore had been leading Burkina Faso, a poor, landlocked country in Western Africa, since 2015. But he faced growing criticism from civilians and the military alike over his government’s inability to beat back the Islamic insurgents creating havoc in this nation of 21 million people.

Burkina Faso had remained largely peaceful until 2015. But that year, militant groups launched a violent campaign as part of a broader upheaval in the Sahel, the vast stretch of land just south of the Sahara.

The violence has destabilized large swathes of Burkina Faso, displacing 1.4 million people and causing 2,000 deaths last year alone. And it led to mounting public frustration with Kabore, 64, whom younger people especially faulted for the government’s failure to stem the tide of violence.

In the past year, there has been a flurry of coups in Africa, the greatest concentration in years, with takeovers in Guinea, Sudan, Chad and Mali.

The coup in Burkina Faso was announced on state television Monday afternoon by a junior army officer who said the army had seized power in response to the “exasperation of the people.” Beside him sat Lt. Col. Paul-Henri Damiba, a senior military officer who was introduced to the people of Burkina Faso as their new head of state.

The military said the nation’s land and air borders would be closed and a nightly curfew imposed until further notice.

There was no mention of Kabore’s whereabouts and no indication that he had agreed to step down.

“The authorities have been captured without bloodshed and are being kept in a secure place,” the soldier said.

The military’s announcement came after a turbulent day in Burkina Faso.

On Sunday, soldiers seized several military bases, and riot police clashed with civilian protesters. In the afternoon, a Twitter post had appeared on Kabore’s account that asked people to stand fast behind their tottering democracy.

“Our country is going through a difficult time,” he wrote, urging mutinying soldiers to lay down their arms.

Public support for the mutiny was driven by a perception that Kabore was incapable of beating back the Islamic groups that have been spreading mayhem for so long, said Rinaldo Depagne, an expert on Burkina Faso at the International Crisis Group.

“He’s not absolutely awful and corrupt,” Depagne said of the deposed leader. “But it’s obvious that people think, rightly or wrongly, that a man in uniform with a big gun is better able to protect them than a democratically elected president.”