Updated

Ugandan lawmakers have passed contentious legislation that could allow one of Africa's longest-serving leaders to rule until 2031.

The bill passed late Wednesday removes a measure in the constitution that prevented anyone over 75 from holding the presidency.

President Yoweri Museveni, a U.S. ally who took power by force in 1986, is 73 and would have been ineligible to run again in 2021.

The new law imposes a two-term limit on the presidency, starting in 2021. That measure had been jettisoned in 2005.

Museveni is the latest in a number of African leaders who have tried to prolong their presidencies by changing the constitution or other means.

Opposition lawmakers put up a spirited effort to prevent the bill from becoming law but the ruling party has a majority in Parliament.