Senegalese troops entered The Gambia on Thursday in support of its new President Adama Barrow, who took office demanding loyalty from his own armed forces in a tense standoff with his defeated rival.
Barrow was sworn in at The Gambia's embassy in Dakar, although longtime leader Yahya Jammeh has refused to step down despite international pressure following his December election loss.
Celebrations erupted in the Gambian capital, which has been on edge over the crisis in the former British colony in west Africa.
Dressed all in white, 51-year-old Barrow waved to crowds at the ceremony that anointed him, seeking to end the 22-year rule of Jammeh, who has not been seen but is believed to be still in Banjul.
"This is a victory of the Gambian nation. Our flag will now fly high among those of the most democratic nations of the world," he said.
Shortly after the inauguration, the UN Security Council unanimously backed efforts by the regional bloc ECOWAS to force Jammeh to hand over power, without formally authorising military action.
"I command the chief of defence staff and officers of high command to demonstrate their loyalty to me as commander in chief without any delay," Barrow said at his inauguration.
"I command all members of the armed forces to remain in their barracks, those found wanting or in possession of firearms without my order will be considered rebels."
Britain was among foreign powers to congratulate the new president.
Barrow, an opposition coalition candidate, defeated Jammeh, who had ruled the former British colony since taking power in a coup in 1994, in a surprise election win on December 1.
Jubilation for Barrow voters
Troops from Senegal, Ghana and Nigeria readied for a possible intervention against Jammeh, whose mandate expired at midnight Wednesday.
A Senegalese army spokesman confirmed his country's troops had crossed the border, after Nigerian jets overflew The Gambia.
Shops had stayed shuttered and streets were quiet in and around the capital Banjul before the inauguration. Tour operators had continued to evacuate hundreds more tourists from the tiny country's popular beach resorts.
But Barrow supporters on Thursday evening took to the streets of Banjul, where soldiers were seen but did not intervene.
"For the last 22 years we were living under a state of dictatorship," Corra Kah said in a suburb of Banjul as he watched the inauguration. "Now we are free".
In off the cuff remarks, army chief Ousman Badjie insisted his soldiers would not get involved in a "political dispute" or prevent foreign forces from entering the west African nation.
Barrow, a real-estate agent turned politician, flew to Senegal on January 15 after weeks of rising tension over Jammeh's stance.
The incumbent initially acknowledged Barrow as the victor but later rejected the result.
He then attempted to block Barrow's inauguration with a court ruling and by declaring a state of emergency this week.
A senior member of Barrow's opposition coalition, Isatou Touray, welcomed the army chief's declaration.
"That's a very positive outlook from him, given that Jammeh's regime is done," Touray told AFP.
"We don't have to risk the lives of innocent citizens."
In remarks at a hotel restaurant late Wednesday, Badjie said he loved his men and would not risk their lives in a "stupid fight," witnesses said.
Arriving back from The Gambia at Manchester airport in England, several passengers could be seen comforting a Gambian national and UK resident who had tried unsuccessfully to get his family out.
Ebrima Jajne described the situation as "really scary for everybody... because this president (Jammeh) doesn't want to step down and people are fleeing."
Tourist Ralph Newton said local residents had done what they could to reassure visitors, despite the threat to themselves.
"All the locals were just worried... They said it's a bad time for us but you'll be alright... It'll be us they come for, if they come for anybody."
After 11th-hour talks in Banjul, Mauritanian President Mohamed Ould Abdel Aziz held a meeting with Barrow also attended by Senegal's President Macky Sall, the private RFM radio station reported.
It was not clear whether the Mauritanian leader had secured a deal or made an asylum offer to Jammeh.
The last-minute intervention came after several unsuccessful attempts at diplomacy by the 15-nation Economic Community Of West African States (ECOWAS).
Mauritania is not part of ECOWAS and diplomats have previously reached out to the conservative desert nation in hopes of brokering a deal with Jammeh.