After more than two decades in power, Gambian President Yahya Jammeh faced the prospect of a military intervention by regional forces, as the man who once pledged to rule the West African nation for a billion years clung to power.

After a midnight deadline set by the West African regional bloc to step down, there was no word from Jammeh. But Mauritania's leader appeared to be making a last-ditch diplomatic effort, meeting with Jammeh and then flying to Senegal to meet with its leader and Gambia President-elect Adama Barrow.

"The mandate of the president is finished at midnight," declared Seydou Maiga Moro, speaking on Senegalese radio station RFM. "All the troops are already in place," he added, saying they were merely waiting to see whether Jammeh would give in to international pressure to cede power to Barrow.

As midnight approached, Jammeh met with Mauritanian President Mohamed Ould Abdel Aziz on the crisis. The Mauritanian leader left Gambia shortly before midnight, telling Gambia state television that "I am now less pessimistic (Jammeh) will work on a peaceful solution that is in the best interest for everyone." He then went to the meeting at the Dakar airport in Senegal, state television there reported.

Thousands of Gambians have fled the country, including some former cabinet ministers who resigned in recent days. Hundreds of foreign tourists evacuated on special charter flights, though some continued to relax poolside despite the political turmoil. Gambia is a popular beach destination in winter, especially for tourists from Britain, the former colonial power.

The downtown area of the Gambian capital, Banjul, was empty late Wednesday, with all shops closed. But there was no visible military presence apart from a checkpoint at the entrance to the city.

Tiny Gambia is surrounded by Senegal and the Atlantic Ocean. Late Wednesday, witnesses reported Senegalese soldiers deploying in the Senegalese Kaolack region, north of Gambia, and in the southern Senegalese region of Casamance.

In another sign of the international pressure, Nigeria confirmed a warship was heading toward Gambia for "training," and RFM radio reported that Nigerian military equipment had begun arriving in Dakar. Ghana also has pledged to contribute militarily.

The regional bloc was seeking the U.N. Security Council's endorsement of its "all necessary measures" to remove Jammeh. "There is a sense that the whole situation rests in the hands of one person, and it's up to that person, the outgoing president of the Gambia, to draw the right conclusions," said Sweden's U.N. Ambassador Olof Skoog, the current council president.

The opposition has vowed to go ahead with Barrow's inauguration. It was unclear whether Barrow would take the oath at a Gambian Embassy outside the country or if he would return.

"Those who resist peaceful change, effective 12 midnight tonight, shall face definite consequences, to their peril," said Mai Ahmad Fatty, Barrow's special adviser, in a Facebook post Wednesday in which he urged Gambians to stay indoors. "Anyone with firearms tonight shall be deemed a rebel, and will certainly become a legitimate target."

Jammeh, who first seized power in a 1994 coup, has insisted that his rule was ordained by Allah. He initially conceded defeat after the December vote, but after reports emerged suggesting he could face criminal charges linked to his rule, he reversed himself a week later. He said voting irregularities invalidated the results, and his party went to court seeking a new round of voting. The case has stalled because the supreme court currently only has one sitting judge.

Human rights groups have long accused Jammeh of arresting, jailing and killing political opponents, and there have been widespread fears for Barrow's safety. Tensions have been so high that Barrow has remained in the Senegalese capital since last weekend, at the advice of ECOWAS mediators. He was not even able to return to Banjul for his 7-year-old son's funeral Monday after the child was fatally mauled by a dog.

As other longtime West African strongmen have died or been forced to step down in recent years, Jammeh has remained a rare exception — even launching a campaign to anoint himself "King of Gambia."

In 2007, he claimed to have developed a cure for AIDS that involved an herbal body rub and bananas. Alarming public health experts, he insisted AIDS sufferers stop taking antiretroviral medications.

Two years later, his government rounded up nearly 1,000 people it accused of being witches, forcing them to drink a hallucinogen that caused diarrhea and vomiting. Two people died, according to Amnesty International.

More recently, Jammeh seemed bent on increasing Gambia's isolation on the world stage. In 2013 he exited the Commonwealth, a group made up mostly of former British colonies, branding it a "neo-colonial institution."

He also issued increasingly virulent statements against sexual minorities, vowing to slit the throats of gay men and saying the LGBT acronym should stand for "leprosy, gonorrhea, bacteria and tuberculosis." And in October, Jammeh said Gambia would leave the International Criminal Court, which he dismissed as the "International Caucasian Court."