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, informs BBC.
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.
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.