(Refiles to add Dakar to dateline)
* Mediators made final mediation attempt
* 7,000 troops take part in regional mission
* Streets of capital quiet
By Tim Cocks and Emma Farge
BANJUL/DAKAR, Jan 20 (Reuters) - Gambia's longtime ruler Yahya Jammeh, who refused to accept his election defeat last month, has agreed to go into exile, a senior adviser to new President Adama Barrow said on Friday, but talks to finalise the deal were holding up his exit.
Regional armies, who entered Gambia late on Thursday, were meanwhile poised to remove him by force if required, as even his army chief, who had stood beside the former coup leader, recognised his rival Barrow as commander-in-chief.
West African leaders Alpha Conde of Guinea and Mauritania's President Mohamed Ould Abdel Aziz travelled to the capital Banjul on Friday to allow Jammeh one last chance to cede power peacefully.
"I can assure you that he has agreed to leave," Mai Ahmad Fatty, Barrow's special advisor, told Reuters in Senegal's capital Dakar. He could not say where Jammeh would go into exile.
Barrow, who won the Dec. 1 poll by a slim margin, was sworn into office at Gambia's embassy in Dakar on Thursday and immediately called for regional and international support.
West African militaries announced soon after that they had crossed into Gambia, which is almost completely surrounded by Senegal.
"The rule of fear has been banished from Gambia for good," Barrow told a crowd gathered at a Dakar hotel on Friday. "To all of you forced by political circumstances to flee our country, you now have the liberty to return home."
Gambia's army chief General Ousman Badjie, who had been perhaps the last remaining pillar of support for Jammeh, said he would welcome, not fight, the regional force.
"We are going to welcome them with flowers and make them a cup of tea," he told Reuters. "This is a political problem. It's a misunderstanding. We are not going to fight Nigerian, Togolese or any military that comes."
The military operation was halted late on Thursday to give mediation a chance.
A midday deadline was extended on Friday as negotiations, which diplomats said were focusing on a deal that would grant Jammeh immunity from prosecution, continued.
One regional diplomat said the delegation was planning to spend the night in Banjul and Jammeh was looking for "extremely solid guarantees" before leaving.
"There is a real possibility this could work. I don't think he is going the (Saddam) Hussein route," he said, referring to the Iraqi leader who was arrested in 2003 following an invasion, then tried and hanged.
Jammeh, in power since a 1994 coup, initially conceded defeat to Barrow before back-tracking, saying the vote was flawed and demanding a new ballot.
During his 22-years in power, Jammeh, who once vowed to rule Gambia "for a billion years", has been accused by rights groups of torturing and killing perceived opponents. And some Gambians were angered by the prospect of granting him immunity.
"I don't want that man to escape punishment from us," said Lamin Darboe, 35, a Gambian shopkeeper who was present at Barrow's speech in Dakar on Friday. "Wherever he moves to we'll follow him there and grab him."
Late on Thursday, Jammeh dissolved the government - half of whose members had already resigned - and pledged to name a new one.
His estate, located almost on the border with Gambia's sole neighbour Senegal, was heavily fortified on Friday, witnesses said.
ECOWAS says its intervention, dubbed Operation Restore Democracy, involves 7,000 troops backed by tanks and warplanes. Its forces entered Gambia from the southeast, southwest and north.
Reuters witnesses saw a fresh convoy of more than a dozen trucks loaded with heavily armed Senegalese soldiers arrive at the border near the Senegalese town of Karang on Friday afternoon.
The size of Gambia's army is unclear, but estimates range from 800 up to 2,500 soldiers.
The U.N. refugee agency UNHCR said about 45,000 people, mainly children, have fled to Senegal since Jan. 1 amid growing fears of unrest.
Thousands of tourists, who'd flocked to the popular beach holiday destination for a break from the harsh European winter, also left this week.
(Additional reporting by Diadie Ba and Nellie Peyton in Dakar and Kissima Diagana in Nouakchott; Writing by Joe Bavier; Editing by Tom Heneghan and Andrew Hay)
Diplomats said regional leaders had been close to a deal before but talks broke down over where Jammeh goes. While Barrow's aides say Jammeh can remain in the country on his Kanilai estate, Senegal insists he leave Gambia, diplomats said.
His estate is heavily fortified, witnesses say, and just 1 km from Senegal's border.
"There is a real possibility this could work. I don't think he is going the (Saddam) Hussein route," said a regional diplomat, referring to the Iraqi leader who was arrested in 2003 following an invasion, tried and hanged.
One of Africa's smallest countries, Gambia is of little strategic significance. But if a peaceful transition of power fails, it would be a setback for the advance of democracy in Africa, a continent where autocrats have often held sway since the end of Western colonial rule.
Jammeh, who once vowed to rule Gambia "for a billion years", earned a reputation for torturing and killing perceived opponents. He pulled Gambia out of the Commonwealth in 2013 and declared the country an Islamic state in 2015.
REFUGEES FLEE TO SENEGAL
Gambia's only land border is with Senegal and the regional coalition, which ECOWAS says involves 7,000 troops, which is backed by tanks and warplanes, entered from the southeast, southwest and north.
U.N. officials including Mohammed Ibn Chambas, U.N. Special Representative for West Africa and the Sahel, were already in Banjul.
Streets in the capital were mostly deserted on Friday and shops, restaurants and petrol stations were shut.
The U.N. refugee agency UNHCR said about 45,000 people, mainly children, have fled to Senegal since Jan. 1. It cited figures from the Senegalese government.
Residents near the border said army defectors were among them and one resident said he saw four Gambian military vehicles crossing into Senegal overnight.
Thousands of tourists have also left the country. Gambia, with its Atlantic beaches, is a popular holiday destination for Europeans and tourism is a mainstay of an economy otherwise reliant on peanut production and remittances from overseas.
Barrow has been recognised as Gambia's new president by world powers and Jammeh is increasingly isolated at home as ministers abandoned his camp.
Hundreds of people celebrated Barrow's swearing in and the ECOWAS advance into Gambia.
Jammeh on Thursday dissolved the government - half of whose members have resigned - and pledged to name a new one.
Support for him remained strong in some quarters, reflecting his years of power in the country of 1.8 million people.
"Why should the other countries interfere. Why should they force him to leave?" said Momodou Badji, 78, in Banjul's Kanifing neighbourhood.
On Thursday night, army chief General Ousman Badjie, who had stood by Jammeh, was seen smiling on the streets, wading through a mass of jubilant Banjul residents shouting and dancing.
(Additional reporting by Emma Farge and Diadie Ba in Dakar and Kissima Diagana in Nouakchott; Editing by Angus MacSwan; Writing by David Lewis and Matthew Mpoke Bigg, Editing by Angus MacSwan)
Our Standards: The Thomson Reuters Trust Principles.