Last month the Ugandan parliament passed an anti-homosexuality bill that meant anyone who identifies as LGBT could face life in prison.
That part has now been removed in a slightly watered down version but it's still one of the toughest pieces of anti-gay legislation in Africa.
The new bill – which hasn't been signed into law by the president yet – has been heavily criticised by international human rights groups.
It prescribes the death penalty for what it calls aggravated offences such as child abuse.
And landlords who knowingly rent premises for homosexual acts risk going to prison for seven years.
Last month, the BBC got access to secret shelters in Uganda where LGBT people have sought refuge after being kicked out of their homes.
Now Newsbeat has spoken to two young people who've fled the East African country for neighbouring Kenya because of the tough new laws.
Diane* – who's in her 20s – was outed after people raised suspicions about her girlfriend and went through her phone.
She says her partner was brutally beaten, including by her own father, before they came for her and beat her too.
"The father came with two other men, they started beating us," she says.
"When I came to my senses I realised they had closed the door and went with the keys.
"They locked us in the house for three days."
The couple eventually managed to contact a friend from the LGBT community who came to rescue them.
"He had to bust the padlock with some cutters," Diane says.
"They found us with a lot of bruises, we couldn't walk well because we were terribly beaten.
"We had to leave my place in the night because we couldn't leave in daytime.
"They started looking for us, the security personnel, so we had to hide there [at the friend's house]."
The friend let the couple stay with him for a week but this was around the time the anti-homosexuality bill was going through parliament in March.
Diane says they knew they weren't safe so took the risk of reaching out for help on TikTok and Twitter.
They came across the Twitter account of Trans Rescue – which helps people escape from dangerous places around the world – who helped them get to Kenya safely.
"It is a scary thing to leave all you've known – with nothing – and try to start again," she says.
"Something evil has been put into society. We would be attacked, we would not be safe, Uganda is not safe."
Jeff* is another Ugandan who fled to Kenya after being outed as gay.
He was at a conference when his boss saw him talking to another man who was later arrested for being gay.
Jeff, who's a doctor practising medicine, was asked to explain his connection to the man.
Much like Diane, he says his employers made him unlock his phone and went through his messages, before he was told he couldn't stay in his post.
The rumours then reached his landlord who kicked him out because the new bill stops him from being able to rent a property.
"After being outed and the rumours started spreading, I couldn't move during the day," he says.
"If I moved during the day people were looking for me.
"That very day when I went back home, I failed to sleep in the house."
Jeff, who's in his early 30s, says he couldn't communicate with his family and had to try and survive without work and somewhere to live.
"These people who were looking for me just to carry out mob justice, to beat me, they were just around the clinic where I was working," he says.
"That's why I couldn't move during the day."
Jeff says he felt he couldn't trust anyone so had to "take the risk and run for my life".
Gay sex is illegal in Kenya under laws introduced when it was under British colonial rule – and its high court rejected an attempt to overturn these in 2019.
But Jeff says he now feels safer there and doesn't see how he could ever go back to Uganda.
"I believe going back to Uganda is not safe because there's no way I could reside there," he says.
He feels the Ugandan parliament sees homosexuality as "a threat to their culture" and won't be easily swayed by international disapproval.
Both Jeff and Diane agree that they want a future free of discrimination and victimisation – even if it is unlikely to be in Uganda.
"I really just want to live freely," says Diane.
She says she has witnessed abusive behaviour and "finger-pointing", with LGBT people being called "devils" by passers-by, and wants to escape this.
Jeff agrees: "I just need to live somewhere where I'm free to exercise my rights."
He says keeping your sexuality a secret takes a heavy toll.
"You're just hiding out, you have to do everything without anyone knowing about it," he says.
"You'll just be hiding your sexuality which can cause you major trauma."
*Names have been changed to protect identities
Follow Newsbeat on Twitter and YouTube.
Listen to Newsbeat live at 12:45 and 17:45 weekdays – or listen back here.
close Video Fox News Flash top headlines for December 21 Fox News Flash top headlines…
close Video Fox News Flash top headlines for December 21 Fox News Flash top headlines…
close Video Wife of American hostage still held in Gaza calls for his and others…
close Video New Jersey mayor says 'my residents are concerned' about drone sightings Mayor Michael…
close Video Luigi Mangione ‘cooperative’ with law enforcement as federal charges pile up Fox News…
Cybersecurity has been a major subject of discussion in recent years, with purported Chinese spy…