"I do not wish for blood to be shed anymore so I can maintain power," said Keïta, speaking just after midnight local time through a surgical mask. "I have decided to quit my duties."
His exit comes after tens of thousands of Malians have flooded the streets of the capital, Bamako, in recent weeks, accusing Keïta of thwarting their chances at prosperity with corruption and botching a near-decade-long fight against extremists.
The African Union Commission, the United Nations and West African leaders swiftly condemned the uprising, calling for the release of Keïta, as well as Mali's prime minister and other top officials.
Chaos reigned in Bamako on Tuesday. Soldiers barricaded roads, surrounded the national television station and fired bullets into the air.
People responded with glee in live videos, cheering as troops rolled through the city. Men in military fatigues grinned from the backs of pickup trucks, waving their guns.
"They have IBK!" city dwellers can be heard shouting in the footage, invoking the president's initials.
The soldiers also detained the president of the National Assembly and the finance minister, according to local journalists. Photos circulating on WhatsApp showed the justice minister's house ablaze.
Before his arrest, Mali's prime minister, Boubou Cissé, acknowledged the "legitimate causes" of his countrymen's anger and invited the soldiers to talk.
"There is no problem that cannot be solved with dialogue," he said in a statement.
The pandemic had further stoked anger after state lockdowns pushed many people out of school and work. Forty-three percent of Malians live on less than $1.90 per day, according to the World Bank.
As signs of a coup mounted, Western officials expressed alarm over the possibility of Keïta's departure.
"The United States opposes any extra-constitutional change of government, whether by those on the streets or by the defense and security forces," tweeted Peter Pham, the U.S. special envoy to the Sahel region.
France "condemns with the utmost firmness this serious event," Foreign Minister Jean-Yves Le Drian tweeted.
Protesters surrounded Bamako's independence monument throughout the afternoon and into the evening, many carrying signs that read, "Adieu, IBK."
In the crowd was Ibrahim Dembele, a 31-year-old pot maker, who covered his face with a black scarf to protect against the coronavirus.
"We heard soldiers are rising up against the president," he said, "and we will stay here until he resigns."
The sudden takeover bore resemblance to Mali's last military rebellion, in 2012, which also started with reports of unrest at the Kati army camp about eight miles north of Bamako.
Soldiers stormed the presidential palace in the capital that March, then declared they had overthrown the government of Amadou Toumani Touré.
International condemnation followed. The African Union suspended Mali until "constitutional order" returned. Keïta, who was elected in 2013 and again in 2018, vowed to restore peace.
Yet tensions have swelled as the nation grapples with fighters loyal to al-Qaeda and the Islamic State. The militants emerged eight years ago in the country's north and have since spilled over the border into Burkina Faso and Niger.
Deaths from terrorism across the three countries have shot up fivefold since 2016, surpassing 4,000 in 2019 — and the number of fatalities this year has nearly eclipsed last year's count, according to the Armed Conflict Location and Event Data Project.
Hundreds of West African soldiers have died trying to vanquish the scourge, which has rendered much of Mali's countryside uninhabitable. Five infantrymen died this month in the central region when suspected terrorists ambushed a military convoy.
Protesters — led by an influential conservative imam, Mahmoud Dicko — invoked the bloodshed as they filled the streets of normally peaceful Bamako starting in June, slamming what they call a weak security strategy beset by corruption.
They accuse Keïta of rigging parliamentary elections in favor of his preferred candidates.
They have also taken issue with the army's heavy-handed responses in rural communities, which, they say, have led to the deaths of innocent villagers. The former president's office has said that such incidents are under investigation.
Several West African heads of state traveled to Bamako this summer to hold peace talks with both parties, including the presidents of Senegal, Ghana, Niger and Nigeria. Regional stability was at stake, they said.
Violence in the Sahel, which runs below the Sahara, threatens to spiral without strong governance from all its leaders, said W. Gyude Moore, a Liberian former official focused on corruption and fragile governments at the Center for Global Development in Washington.
A coup in Mali could be devastating for its neighbors, which already struggle with porous borders.
"The fragility across the Sahel is something that frightens every leader in the region," Moore said. "If one country falls, that instability spreads to others like a contagion."
Borso Tall in Dakar and Mamadou Tapily in Bamako contributed to this report.