Zambia's top court ruled Friday that President Edgar Lungu is eligible to run for re-election in 2021 polls after an opposition party argued he would exceed the constitution's two-term limit.
Mr Lungu completed former president Michael Sata's term after he died in 2015 before winning a full term in his own right in 2016.
"The presidential tenure starting on January 25, 2015 to September 13, 2016 cannot be considered as a full term," said constitutional court judge Hildah Chibomba.
President Lungu announced in January 2017 that he would seek a fresh five-year term in 2021, prompting opposition parties to block him.
The opposition United Party for National Development and the Law Association of Zambia lawyers' association argued he was ineligible to run, having effectively served across two terms.
Three other opposition parties simply sought the court's opinion on the matter.
"I hope the debate comes to an end. This is a victory for Lungu, it's a victory for the (ruling) Patriotic Front and a victory for the people of Zambia," said the party's secretary general Davies Mwila who spoke outside court.
Hundreds of Mr Lungu's supporters celebrated outside the court following its ruling.
In 2017 Lungu warned Zambia's judges against blocking him from running in the 2021 vote, saying a judicial intervention like that seen in Kenya could plunge the country into chaos.
Kenya was rocked by two months of political drama and acrimony, triggered by the Supreme Court's decision to overturn an election in August 2017 over widespread irregularities.
President Lungu has been accused of piling up foreign debt and cracking down on dissent since winning the contested election in 2016.
Zambia's opposition has accused him of increasingly authoritarian behaviour as several politicians and activists critical of his regime have faced legal action.