The political standoff in Gambia intensified on Thursday as foreign troops crossed the border with orders to dislodge a repressive leader who has refused to step down after losing a presidential election last month.

Gambia’s erratic leader, Yahya Jammeh, seized power in a coup 22 years ago and once said he could rule for a billion years. But on Thursday the Senegalese military headed toward the capital of Gambia, Banjul, where Jammeh has been holed up in the state house, insisting that his rule is still valid.

Jammeh has warned that he will fight back against any foreign military intervention. At least 26,000 Gambians, worried about violence, have fled the country, the United Nations says, and several senior officials in Jammeh’s government have resigned in protest or have left the nation as well.

As the invasion began, the winner of the election, Adama Barrow, was being sworn into office in a brief ceremony about 150 miles outside of Gambia. The inauguration took place in a nondescript room at the Gambian Embassy in Dakar, Senegal, because Barrow has so little control over his country that he did not go home for the funeral of his son, who had been killed by a dog over the weekend.

Barrow’s team ultimately decided that the embassy in Dakar was the closest they could safely get to Gambian soil to start the new administration. Plans for an elaborate ceremony in a soccer stadium in Gambia’s capital had to be scrapped amid the standoff.