DAKAR, Senegal — The president of Mali resigned late Tuesday hours after he was arrested by military officers who staged a coup following months of protests, further destabilizing a West African country that has been battling a violent insurgency.

President Ibrahim Boubacar Keïta went on state television around midnight and said that the national assembly and the government would be dissolved as a consequence of his departure. He and his prime minister, Boubou Cissé, had been arrested along with other government officials earlier in the day.

“For seven years I had the happiness and the joy of trying to straighten out this country,” Mr. Keïta said, wearing a white cap and robes, his speech muffled by a surgical mask. “I don’t want any blood to be shed to keep me in my position.”

The rebellion came amid a growing protest movement driven by charges that Mr. Keïta had stolen a parliamentary election in March and installed his own candidates. Demonstrators have also been angered by the government’s failure to address corruption and the violence by Islamist insurgents and other armed groups that has plagued the country for eight years.

The streets of Bamako, the capital, had exploded with jubilation and gunfire earlier in the day. At Independence Square in the middle of town, hundreds of people gathered in what appeared to be a spontaneous demonstration, pumping their fists, blowing vuvuzelas and cheering the soldiers who drove past, firing their weapons.

“Goodbye, I.B.K.,” read a placard, using Mr. Keïta’s nickname. “Long live Mali.”

And with the music turned up loud, rifles bristling from their windows, people riding in a column of military vehicles broadcast their actions live on Facebook.

ImageThe arrests of President Ibrahim Boubacar Keïta, right, and his prime minister, Boubou Cissé, left, were confirmed by one of the president’s former bodyguards, among others.
Credit…Michele Cattani/Agence France-Presse — Getty Images

Mali has been in crisis since 2012, when rebels and jihadists took control of the country’s north. Despite the intervention of foreign forces, including French troops, American military advisers and United Nations peacekeepers, the unrest has spread.

Led by a coalition of politicians, civil society leaders and a popular imam, Mahmoud Dicko, Malians had risen up to demand Mr. Keïta’s resignation, descending by the thousands onto Bamako’s streets. In mid-June, security forces shot and killed at least 11 protesters in violence that further drove the protest movement.

The turmoil represented a sharp change in fortunes for the once-popular Mr. Keïta, who won a landslide election in 2013 in the wake of a military coup.

The arrests were confirmed on Tuesday evening by one of Mr. Keïta’s former bodyguards, Ali “Banou” Mariko, who told local radio stations, “We’ve just arrested the president of the republic together with his prime minister Boubou Cissé and his campaign aide.”

They were taken to a military camp in Kati, 10 miles outside Bamako, where the mutiny began early Tuesday, Mr. Mariko said. Pictures of what appeared to be the president and the prime minister getting out of S.U.V.s at the camp — the president dressed in his trademark white robes and the prime minister in a suit and surgical mask — were circulated among local journalists and on social media.


Credit…EPA, via Shutterstock

They were not the only ones arrested. A government official, who did not want to be identified because of the unstable situation, said in an interview that he saw soldiers arrive in pickup trucks and arrest the finance minister in his office on Tuesday morning. Local media also reported that the president of the national assembly was taken from his home.

The prime minister, Mr. Cissé, had released a statement on Tuesday, before his arrest, calling for “reason and patriotism, and for the guns to be silenced.” There was no problem that could not be solved by dialogue, he said, taking a conciliatory tone.

“The government calls for appeasement and is available to engage in fraternal dialogue in order to dispel any misunderstandings,” the statement read.

The Malian crisis grew partly out of the Libyan one. After the fall of Col. Muammar el-Qaddafi in 2011, hundreds of heavily armed Malian rebels who had fought for the Libyan leader returned home and attacked northern towns.

In the chaos that followed, a military officer led a coup, overthrowing President Amadou Touré a month before elections were to be held.

Mr. Keïta came to power a year and a half later, winning an August 2013 election by an overwhelming margin. He was a popular figure then, a former prime minister and parliamentary speaker seen by Mali’s youth as an honest and fair man who could get things done, and who had good contacts among rich donors.

But as his tenure went on, security became more elusive in the country, with its central regions destabilized by Islamist and intercommunal violence. The military has been accused of abusing civilians while fighting the insurgents, and peace talks have repeatedly failed.


Credit…Agence France-Presse — Getty Images

The violence has spread to Burkina Faso and Niger, and the whole region has been affected by the fallout.

The United States has a significant presence in the Sahel, a vast sub-Saharan scrubland that stretches from Senegal to Sudan. There are about 1,400 U.S. troops in the Sahel, including Special Operations troops, and two drone bases in Niger.

The State Department has in the past two years provided $323 million in training and other security assistance to the so-called G5 Sahel countries — Mali, Burkina Faso, Niger, Chad and Mauritania — to combat the threat. But the G5 force, ultimately set to grow to 5,000 troops, has been slow to halt the militants’ advance.

“Mali’s internal governance and security challenges are driving instability across the Sahel,” said Kyle Murphy, a former senior analyst with the Defense Intelligence Agency, now with the Center for Strategic and International Studies.

France has by far the biggest footprint in the region, including around 5,000 soldiers, multiple bases and sophisticated air power, including drones. After threatening to withdraw troops late last year, President Emmanuel Macron of France promised even more soldiers, and said his country would work more closely with military forces in the region. The enduring French presence has given rise to several angry protests in Bamako.

The French foreign minister, Jean-Yves Le Drian, condemned the mutiny in a statement on Tuesday.

Mr. Keïta’s perceived failure to protect Malian citizens was a major factor in his fall from grace, analysts said. But what sent Malians, and in particular the residents of Bamako, into the streets was a long-delayed parliamentary election in March, in which Mr. Keïta was accused of installing his preferred candidates instead of those who had won.

Despite the coronavirus pandemic, and the killing of protesters by security forces in June, demonstrations have ballooned, with people turning out week after week to demand Mr. Keïta’s resignation.

Attempts at mediation in the past month by regional leaders, led by former President Goodluck Jonathan of Nigeria, have failed to dampen the protest movement.

Ecowas, the union of West African nations, issued a statement asking for sanctions to be imposed on the coup plotters, suspending the country from all its decision-making bodies and closing the land and air borders with Mali. Ecowas said it would send a delegation to Mali.

U.N. Secretary General Antonio Guterres called for the release of those arrested. And Peter Pham, U.S. special envoy for the Sahel region, said in a post on Twitter: “The US opposes any extra-constitutional change of government, whether by those on the streets or by the defense and security forces.”

But in central Bamako, those involved in the arrests took a triumphant tone.

“Nobody can take this country hostage,” said Sidy Tamboura, the secretary-general of the national police union, surrounded by young protesters, in a clip shared with journalists. “It’s already over for this rotten, incompetent regime.”

Cheick Amadou Diouara contributed reporting from Gao, Mali, and Eric Schmitt from Washington.