Johannesburg - The tiny nation of Gambia has West Africa on the brink of a military intervention, and thousands, including cabinet ministers, are fleeing the country. Longtime President Yahya Jammeh is refusing to step down after losing elections and has declared a state of emergency. On Thursday, President-elect Adama Barrow intends to go through with his inauguration, with the support of the international community. Here's a look at the crisis.I CONCEDE ... NO, I DON'TAt first, Jammeh stunned Gambians by conceding his election loss on live television. A week later, he announced he had changed his mind, saying "only Allah" could deny him victory. After taking power more than 22 years ago in a bloodless coup, Jammeh has been accused of leading a government that detains, tortures and even kills opponents. He is no stranger to striking declarations: In late 2015, he abruptly announced Gambia to be an Islamic republic. In 2013, he decided to leave the Commonwealth.A LEGAL CHALLENGE, BUT IS THERE A COURT?Jammeh's ruling party is challenging the December 1 election results, saying there were irregularities in the vote, but the country's Supreme Court says it could take months to act because it is short of judges. Jammeh has invited judges from Nigeria and Sierra Leone to complete the court, but that is not expected to happen until May. It is not clear what will happen if Barrow is inaugurated and the court later decides in Jammeh's favor.Barrow is currently in neighbouring Senegal and has been urged by regional countries to stay there until Thursday's inauguration for his safety.NEIGHBOURS PREPARE TROOPSThough diplomatic efforts continue, the Economic Community of West African States has a standby military force ready to enter Gambia if Jammeh doesn't cede power when his mandate ends on Thursday. If the use of force is necessary, a UN envoy has said Ecowas will seek the endorsement of the UN Security Council and the African Union Peace and Security Council to deploy the troops. Gambia, a nation of 1.9 million people, is estimated to have an army of just 900 troops.A CONTINENT SHIFTS AWAYIf Jammeh doesn't step down, whether peacefully or not — he briefly sent troops to occupy the electoral commission office during the crisis — the African Union will cease to recognise him as Gambia's legitimate leader, the AU's Peace and Security Council said last week. In announcing the state of emergency on Tuesday, Jammeh blamed what he called the unprecedented level of foreign involvement in Gambia's election.