Bernard Randall
Bernard Randall facing two years in jail for being gay (Facebook)

A British pensioner has said he is "terrified" at the prospect of spending two years in a Ugandan prison after police found photos of him having sex with another man on his laptop.

Bernard Randall, 65, pleaded not guilty to charges of "trafficking obscene publications" in a Ugandan court.

His laptop had been stolen and files from the computer were handed to a tabloid newspaper that specialises in sex stories, AFP reported.

Homosexuality is illegal in Uganda and is punishable by up to 14 years in jail.

A Ugandan man was also charged with acts of gross indecency and he faces seven years in jail if found guilty.

Randall said: "[They were] private images on a private computer. If any trafficking was done, it was by the robbers who took the laptop, and the newspaper for printing them."

Heartbreaking situation

Randall feared that publicity around the case could make him a target of homophobic bigots and violence. In 2011, gay rights activist David Kato was beaten to death at his home after a newspaper published photos of him in an issue demanding that homosexuals be hanged.

"I was terrified. I've put padlocks on the windows, checked all the locks on the door," said Randall.

"Ugandans are very kind people and ordinary Ugandans have responded wonderfully - some gay, some not gay - but all saying 'it is your life to do with it as you want. The situation I face breaks my heart."

Randall came out as gay shortly after his wife of 40 years died in 2011. He has two adult daughters and had been visiting Uganda on holiday when he was arrested. He was taken for a medical exam to "check" his sexuality.

Since his arrest, LGBT activists have sought his return and he has gained support from Stephen Fry and campaigner Peter Tatchell.

A Facebook group, Bring Bernard Home, has been set up and has almost 700 supporters.

A spokesman for the Foreign Office said it is aware of the situation and was providing consular assistance.