(CNN)Gambian President Yahya Jammeh has so far refused to step down after losing his bid for a fifth term. He has been in power for more than 22 years, but other current African leaders have ruled longer, many of them buoyed by little tolerated opposition and abolished or manipulated term limits.
Africa's current longest-serving leaders
Seven of them have led for more than 30 years. They are:
In power since: August 3, 1979, when he toppled his uncle in a military coup.
Current election rules: The president is elected in a majority popular vote for seven-year terms. This leader last claimed victory in an April 2016 election, reportedly with 93.7% of the vote. Opposition members and human rights groups have questioned the elections' fairness.
In power since: September 1979, when he was elected the ruling party's leader upon the previous president's death.
Current election rules: Under terms of a constitution approved in 2010, the leader of the party that wins a popular parliamentary vote is president for five years. Dos Santos' party won elections in 2012, so under the new rules, he started the first of a possible two terms. The election was Angola's third since it gained independence from Portugal in 1975, as it was often wracked by civil war.
In power since: April 1980, when his country gained independence after he coordinated a guerrilla war against white colonial rulers. He first was prime minister, then took the presidency in 1987 -- elected by the national assembly -- when a new constitution created the office to replace the prime minister's office.
Current election rules: Five-year terms, no term limits. He has claimed victory in popular votes -- sometimes highly controversially -- in 1990, 1996, 2002, 2008, and 2013. He is the last living African leader who's been in power continuously since his country's independence.
In power since: November 1982, when the then-prime minister succeeded a president who resigned.
Current election rules: Majority popular vote for seven-year terms. Last elected in October 2012. No term limits.
In power since: It's complicated. He first was president from 1979 to 1992, when he was defeated in an election. He returned to power in 1997 during a civil war, eventually standing for and winning a presidential election in 2002.
Current election rules: Majority popular vote. Up to three five-year terms, though a 2015 constitutional referendum allowed Sassou-Nguesso to forgo the limits, according to Freedom House, a US nonprofit that promotes democracy. The last election was in March 2016.
In power since: January 1986, when Museveni, a guerrilla leader and former defense minister, ousted a military regime.
Current election rules: Majority popular vote for five-year terms, with no term limits. Museveni held the presidency for 10 years before he was chosen in the country's first direct presidential election in 1996. After his re-election in 2001, Parliament removed presidential term limits in 2005. He was elected for a fifth term in February 2016.
In power since: April 1986, upon turning 18, nearly four years after the death of his father, the previous king.
No popular election for the king: Swaziland is Africa's last remaining absolute monarchy, which is hereditary. The country has an elected Parliament, and Mswati chooses a prime minster from among the elected members.