A lawyer for a group of Ugandan opposition leaders has warned that President Yoweri Museveni, 73, is heading for a "life presidency" after a court upheld a constitutional amendment scrapping presidential age limits.
Previously the law required presidential contenders to be under the age of 75 and would have blocked Museveni, president since 1986, from seeking re-election in polls due in 2021.
But a bill removing the limit was introduced in parliament in September and signed into law in December, sparking demonstrations and an outcry from the opposition which accuses Museveni of a power grab. 
A group of opposition figures brought the judicial review heard by judges in a marathon session on Thursday.
"The court has entrenched a life presidency -- one man rule," said human rights lawyer Ladislaus Rwakafuzi who represented the coalition seeking to have age limits reinstated. "I think our judges lacked the courage to tell the president he's been around long enough."
A majority of the constitutional court judges, sitting in the remote city of Mbale, some 225 kilometres east of the capital Kampala, ruled in favour of lifting the age cap for presidential contenders.
Rwakafuzi added that he would be consulting his clients on whether to appeal the ruling.
The opposition's leader in parliament Winnie Kiiza said "we still believe we can get justice at another level".
But the justices struck down lawmakers' efforts to extend their terms of office from five to seven years which would have pushed elections back to 2023, with one judge describing their bid as "selfish".
The judges also decided that an attempt to reintroduce presidential term limits -- scrapped with the reintroduction of multi-party politics in 2005 when the constitution was last amended -- breached parliamentary procedure. They ruled the bid invalid, paving the way for a Museveni to rule indefinitely.
Museveni, who seized power at the head of a rebel army in 1986, once said leaders who "overstayed" were the root of Africa's problems.
However while running for a fifth term in 2016, he said it was not the right time for him to leave as he still had work to do.
Deputy Attorney General Mwesigya Rukutana, who represented the government, said he felt "substantially happy" with the judgement.