The Gambia’s long-term leader Yahya Jammeh says he will step down, after refusing to accept defeat in elections.
In an announcement on state TV, he said it was “not necessary that a single drop of blood be shed”.
The statement followed hours of talks between Mr Jammeh and West African mediators. He gave no details of what deal might have been struck.
Mr Jammeh has led the country for 22 years but was defeated in December’s election by Adama Barrow.
Mr Barrow has been in neighbouring Senegal for days and was inaugurated as president in the Gambian embassy there on Thursday.
Troops from several West African nations, including Senegal, have been deployed in The Gambia, threatening to drive Mr Jammeh out of office if he did not agree to go.
Mr Jammeh’s decision to quit came after talks with the presidents of Guinea and Mauritania.
“I have decided today in good conscience to relinquish the mantle of leadership of this great nation with infinite gratitude to all Gambians,” he said.
“I promise before Allah and the entire nation that all the issues we currently face will be resolved peacefully.”
Shortly before the TV address, Mauritanian President Mohamed Ould Abdel Aziz said that a deal had been struck and that Mr Jammeh would leave the country. He gave no further details.
Mr Jammeh was given an ultimatum to leave office or be forced out by UN-backed troops, which expired at 16:00 GMT on Friday.
The deadline was set by the Economic Community of West African States (Ecowas), a regional grouping backed by the United Nations.
The first signs of a breakthrough came on Friday when a senior aide to the new president told the BBC’s Umaru Fofana that Mr Jammeh had agreed to step down.
Mr Jammeh had at first accepted defeat in the election but then reversed his position and said he would not step down.
He declared a 90-day state of emergency, blaming irregularities in the electoral process.
The electoral commission accepted that some of its early results had contained errors but said they would not have affected Mr Barrow’s win.
Mr Jammeh had vowed to stay in office until new elections were held.