By Tim Cocks and Emma Farge

BANJUL/DAKAR (Reuters) - West African nations launched a military operation in Gambia on Thursday, Senegal's army said, aiming to install its new President Adama Barrow and remove longtime ruler Yahya Jammeh, who refuses to step down despite an election loss.

Barrow took the oath of office on Thursday at Gambia's embassy in Senegal, calling for international support from West Africa's ECOWAS bloc, the African Union and the United Nations.

The intervention, led by a Senegalese general and dubbed Operation Restore Democracy, involves "significant" land, air and sea resources, according to a Senegalese army statement.

"This action aims to re-establish constitutional legality in Gambia and allow the new elected president to take office," it said, adding that the operation was being carried out under an ECOWAS mandate.

A local Senegalese government official saw a military convoy including tanks in Diouloulou, near Senegal's border with Gambia on Thursday morning. And soon after Barrow's swearing in, Senegal's army spokesman told Reuters its forces crossed into its much smaller neighbor.

Nigeria, which pre-positioned war planes and helicopters in Dakar, is also part of the operation, but it was not immediately clear if it too had crossed the border.

Ghana has also pledged troops.

"This is a day no Gambian will ever forget," Barrow said after taking the oath, which was administered by the president of Gambia's bar association. "Our national flag will now fly high among the most democratic nations of the world."

"I hereby make an explicit appeal to ECOWAS, the (African Union) and the UN... to support the government and people of the Gambia in enforcing their will, restoring their sovereignty and constitutional legitimacy," he said.

The U.N. Security Council on Thursday backed ECOWAS's efforts to ensure Barrow assumes power, and the United States said it supported Senegal's intervention.

ECOWAS has been attempting to persuade Jammeh to quit for weeks, and has failed to do so, despite his increasing political isolation and last ditch efforts to reason with him overnight.

Story continues

Jammeh, in power since a 1994 coup and whose mandate ended overnight, initially conceded defeat to Barrow following a Dec. 1 election before back-tracking, saying the vote was flawed.

"THE DICTATOR IS OUT"

Hundreds of Gambians celebrated in the streets, cautiously at first, and then gradually in larger numbers as they realized the security forces looking on were not going to open fire.

Cars whizzed up and down the highway lined with iron-roofed shops in the pro-Barrow Serrekunda district of Banjul, with horns honking and people hanging out of the windows.

"The dictator is out," shouted pharmacist Lamine Jao, 30, as others cheered and whistled in agreement. "It's just a question of time. We'll soon flush him out. Believe me," he said.

During the brief inauguration speech, Barrow asserted his new role as commander and chief of Gambia's armed services, ordering soldiers to stay calm and remain in their barracks. Those who did not would be considered rebels, he said.

ECOWAS and the African Union have said they will recognize Barrow from Thursday and nations including the United Kingdom and France were quick to congratulate Barrow.

U.N. Secretary-General Antonio Guterres in a statement pledged "his full support for his (Barrow's) determination, and ECOWAS's historic decision, with the unanimous backing of the Security Council, to restore the rule of law in The Gambia so as to honor and respect the will of the Gambian people."

Barrow gave the oath in a tiny room in Gambia's embassy in the Senegalese capital, Dakar, and many of those present broke into the Gambian national anthem once he had completed it.

Outside the building on a residential street amid a heavy security presence, dozens of Gambians listened to the ceremony through loudspeakers.

"It's very sad to be swearing in a president in someone else's country," said Fatou Silla, 33, a businesswoman who fled Gambia with her son a week ago.

Fearing unrest, thousands of Gambians have fled, the United Nations estimates.

A senior aide to Barrow said that arrangements would be made for him to return to Gambia though it was unclear when or how.

At a bar in the Gambian capital Banjul's popular Senegambia strip, people crowded around a television to watch the swearing in and cheered and danced when it was over.

"We have been suffering for 22 years and now things will be different," said a cashier who only gave her name as Fama.

As tour companies moved out hundreds of European tourists, shops, market stalls and banks in Banjul remained closed. Police circulated in trucks and soldiers manned checkpoints.

It was unclear what Jammeh's next move would be.

He faces almost total diplomatic isolation and a government riddled by defections. In the biggest loss yet, Vice President Isatou Njie Saidy, who has held the role since 1997, quit on Wednesday, a government source and a family member told Reuters.

Gambia's long, sandy beaches have made it a prime destination for tourists but Jammeh, who once vowed to rule for "a billion years", has also earned a reputation for rights abuses and stifling dissent.

He has ignored pressure to step aside and offers of exile.

(Additional reporting by Nellie Peyton and Diadie Ba in Dakar, Felix Onuah in Abuja, Michelle Nichols at the United Nations and John Irish in Paris; Writing by Joe Bavier and David Lewis; Editing by John Stonestreet and Dominic Evans)