The Gambia’s leader Yahya Jammeh is to step down and leave the country, officials involved in negotiations say.
West African mediators spent several hours with Mr Jammeh on Friday, negotiating his future.
The motorcade carrying the presidents of Guinea and Mauritania has left the official residence, but they are not thought to have left the country.
Mr Jammeh was defeated in December’s election and his successor Adama Barrow has been inaugurated.
But Mai Fatty, a senior aide to the new president, told the BBC’s Umaru Fofana that Mr Jammeh had agreed to step down.
News agency AFP reported that Mr Jammeh had agreed in principle to go but that the terms of his departure were still being finalised.
Mr Barrow told Gambians who had fled the country that they now had “the liberty to return home”.
“The rule of fear has been vanished from The Gambia for good,” he said in the Senegalese capital, Dakar.
Mr Barrow has been in neighbouring Senegal for days. He was sworn in at the Gambian embassy there on Thursday.
West African nations, including Senegal, have deployed troops in The Gambia – threatening to drive Mr Jammeh out of office by force.
Mr Barrow’s legitimacy as president has been recognised internationally, after he won last month’s elections.
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 man who once said he would rule The Gambia for a billion years is finally leaving.
He is thought to have been offered an amnesty deal, so that he will not face charges of human rights abuses.
He had wanted to stay in The Gambia but this was not negotiable.
There have been suggestions he may now go to Guinea, although he has been offered asylum in Nigeria and it is thought Morocco has done the same.
Mr Jammeh’s term expired at midnight on Wednesday – but, while still president, he engineered a parliamentary vote to extend his presidency.
As Mr Barrow has already been sworn in, the country could be said to have two presidents at the same time.
Ecowas said that its forces, from Senegal and other West African countries, had encountered no resistance after entering The Gambia.
After first accepting defeat in the election he 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 said he would stay in office until new elections were held.
By Africafrique and agencies