The anti-gay bill also makes it a crime punishable by a prison sentence not to report gay people.
Uganda’s PM Amama Mbabazi opposed the vote, saying not enough MPs were present.
The bill has been condemned by world leaders since it was mooted in 2009 with President Barack Obama calling it “odious”.
The government knows there will be an international outcry, which could see some countries suspend aid to the country.
Amama Mbabazi might follow up on his complaints about a lack of quorum, while it remains to be seen whether President Yoweri Museveni will sign the bill into law.
The private member’s bill originally proposed the death penalty for some offences, such as if a minor was involved or the perpetrator was HIV-positive, but this has been replaced with life in prison.
The MP behind the bill, David Bahati, told the AFP news agency: “This is victory for Uganda. I am glad the parliament has voted against evil.”
“Because we are a God-fearing nation, we value life in a holistic way. It is because of those values that members of parliament passed this bill regardless of what the outside world thinks,” he said.
The bill’s supporters say it is needed to protect traditional family values, which they say are under attack from Western-inspired gay rights groups.
Its critics say the bill has been pushed by some US evangelical Christians.
Holidaymakers and visiting foreigners are not immune from prosecution under Uganda’s existing anti-gay laws.
Three Indian nationals have been arrested and charged over the killing of Sikh separatist leader…
President Joe Biden has urged pro-Palestinian protesters on university campuses to uphold the rule of…
Blue Ivy Carter has joined the voice cast of The Lion King prequel Mufasa: The…
At least five people, including a four-month-old baby, have been killed after dozens of tornadoes…
Harvey Weinstein has been hospitalized just days after his 2020 rape conviction in New York…
Hamas has published a video showing the first proof of life of US and Israeli…