Kampala - One of Africa's longest-serving leaders could rule until 2031 after Ugandan lawmakers late on Wednesday passed contentious legislation that many in the east African nation saw as an attempt by the president to rule until the grave.The bill removes a measure in the constitution that prevented anyone younger than 35 or older than 75 from holding the presidency. President Yoweri Museveni, a US ally who took power by force in 1986, is 73 and would have been ineligible to run again in 2021.The ruling party, which has a majority in Parliament, had argued that the age barrier discriminated against the elderly. But critics, including many lawmakers who wore red bandanas as a sign of their opposition, insisted the measure was part of what they called Museveni's plan to rule for life.The new law also imposes a two-term limit on the presidency, starting in 2021. It means Museveni could rule until 2031, when he would be 87. By then he would have served 45 years in power.Museveni is the latest in a number of African leaders who have tried to prolong their time in office by changing the constitution or other means. At least 10 countries on the continent have seen term limits dropped, and "leaders in more than 20 countries effectively do not face restrictions on their time in power", according to the US-funded African Center for Strategic Studies.Many Ugandans on social media reacted angrily to news of the bill's passage during an unusually long session, apparently because lawmakers wanted to finish before Christmas.Security forces "It is a dark day and a backward move toward disaster," said Mwambutsya Ndebesa, a political historian at Uganda's Makerere University. "I don't see anything positive in that."Museveni once said he despised African leaders "who want to overstay in power", but now says he referred to those who ruled without being elected. In recent weeks he has discussed his health habits on Twitter, saying he doesn't "have time for sickness."Uganda once had term limits but they were jettisoned in 2005 amid accusations that lawmakers had been bribed to amend the constitution in favor of Museveni. That left the age barrier the only obstacle to a possible life presidency.Wednesday's vote followed heated exchanges and even brawls as opposition lawmakers put up a spirited struggle to prevent the bill from becoming law. Lawmakers had been offered over $8,000 by the Parliamentary Commission to hold consultations on the issue, money that many considered a bribe. Some in the opposition returned the money in protest.During discussions of the bill in September, a number of opposition lawmakers were violently removed from parliamentary chambers by plainclothes soldiers allegedly drawn from the presidential guard. At least two were seriously injured and had to be sent abroad for treatment.Uganda has not witnessed a peaceful transfer of power since independence from Britain in 1962. Museveni's opponents accuse him of using the security forces to harass his critics. His main opponent, Kizza Besigye, has been arrested hundreds of times since 2001.