Gambia's president of 22 years has acknowledged his election defeat, vowing to step down hours after news of the results prompted thousands to celebrate in the streets in an unprecedented display of disdain for his rule.

With TV cameras rolling, Yahya Jammeh called the winner, opposition coalition leader Adama Barrow, on a mobile phone to praise the election and vow not to contest the result.

"Allah is telling me my time is up and I hand over graciously with gratitude toward the Gambian people and gratitude toward you," Jammeh said.

It was a stunning turn of events in a country where critics have long alleged votes are rigged and opponents silenced and jailed. Just five years ago, Jammeh said that he could stay in power for a billion years.