Mali's President Ibrahim Boubacar Keïta has resigned, after being detained by soldiers on Tuesday.
In a televised address he said he was also dissolving the government and parliament, adding: "I want no blood to be spilled to keep me in power."
He and PM Boubou Cissé were taken to a military camp near the capital Bamako, drawing international condemnation.
A spokesman for the soldiers called for "a civil political transition leading to credible general elections".
Mr Keïta won a second term in elections in 2018, but there has been anger over corruption, the mismanagement of the economy and a dispute over legislative elections. It has prompted several large protests in recent months.
There has also been anger among troops about pay and over a continuing conflict with jihadists.
What did Mr Keïta say?
Wearing a surgical mask amid the coronavirus pandemic, Mr Keïta resigned in a brief address on state television.
"If today, certain elements of our armed forces want this to end through their intervention, do I really have a choice?" he asked.
"I hold no hatred towards anyone, my love of my country does not allow me to," he added. "May God save us."
What have the soldiers said?
A televised statement was read out early on Wednesday on behalf of the National Committee for the Salvation of the People.
Air force deputy chief of staff Col-Major Ismaël Wagué said: "Civil society and political social movements are invited to join us to create together the best conditions for a civil political transition leading to credible general elections for the exercise of democracy through a roadmap that will lay the foundations for a new Mali."
He added: "As of today, all air and land borders are closed until further notice. A curfew is in place from 09:00 to 17:00 until further notice."
Flanked by soldiers, Col Wagué said: "Our country is sinking into chaos, anarchy and insecurity mostly due to the fault of the people who are in charge of its destiny,"
What do we know about the mutiny?
It remains unclear who began the mutiny, how many soldiers took part or who will now take charge.
It appears to have started when mutinying soldiers took control of the Kati camp, where the president and PM were later taken.
BBC Afrique's Abdoul Ba in Bamako says it seems to have been led by Col Malick Diaw - deputy head of the Kati camp - and another commander, Gen Sadio Camara.
After taking over the camp, about 15km (nine miles) from Bamako, the mutineers marched on the capital, where they were cheered by crowds who had gathered to demand Mr Keïta's resignation.
On Tuesday afternoon they stormed his residence and arrested the president and his prime minister - who were both there.
The president's son, the speaker of the National Assembly, the foreign and finance ministers were reported to be among the other officials detained.
Kati camp was the focus of a mutiny in 2012, also by mid-ranking soldiers, who were angry at the inability of the senior commanders to stop jihadists and Tuareg rebels taking control of northern Mali.
What has the reaction been?
When news first broke of the mutiny, the United Nations and African Union both called for the release of those held by the soldiers.
The Economic Community of West African States (Ecowas), a regional body, also said its 15 member states had agreed to close their borders with Mali, suspend all financial flows to the country, and eject Mali from all Ecowas decision-making bodies. In recent months, Ecowas has been trying to mediate between Mr Keïta's government and opposition groups.
The UN Security Council is to meet on Wednesday to discuss the latest developments in Mali.
Mali's former colonial ruler, France, was also quick to condemn the president's detention, and Foreign Minister Jean Yves Le Drian urged the soldiers to return to barracks. Mali is a key base for French troops fighting Islamist insurgents across the Sahel region.
A member of Mali's opposition M5 movement, which has held protests against Mr Keïta for the past few weeks, welcomed his resignation.
Prof Ramata Sissoko Cisse told the BBC World Service: "I think it's a relief for the Malian people and for all the citizens of Mali to finally hear from the president that because of the lack of support of the Malian people he finally accepts to resign, to give back power to the people."
M5 is led by the conservative Imam, Mahmoud Dicko, who has called for reforms after rejecting concessions from Mr Keïta.
Why Mali matters to West Africa and beyond
The desert regions of northern Mali are home to various militant groups, some of whom are linked to al-Qaeda, which have also spread into neighbouring Niger, Burkina Faso, Chad and Mauritania.
French troops, working with a regional force known as G5 Sahel, and a 10,000-strong force of UN peacekeepers are based in Mali, trying to tackle the militants.
The French troops first intervened in 2013 to prevent an alliance of Islamist and separatist Tuareg fighters, who had taken control of northern Mali, from marching on the capital.
The rebels had taken advantage of a security vacuum following the country's previous coup, when mutinous soldiers overthrew his predecessor, Amadou Toumani Toure.
Observers are worried that another round of instability in the country could further destabilise the region.
Some of the militant groups are also linked to networks smuggling people and drugs into Europe.