A court in Uganda on Wednesday ordered that a retired gay British man arrested on charges of "trafficking obscene publications" should be immediately deported.
The court dropped the original charge against Bernard Randall, 65, but ordered he be escorted home to pack his belongings and taken to the airport to leave. An official from the prosecutor's office said he was being expelled because he had "kept on corrupting Uganda's youth" and failed to renew his visa.
"The court orders immediate deportation within 12 hours," judge Hellen Ajio told the court, bringing an end to a high profile case that has highlighted the issue of gay rights in the fiercely anti-homosexual African nation.
Randall's lawyer, John Francis Onyango, had asked that his client be given five days in which to leave the country, but said the decision would not be appealed.
"We are glad that the state did, indeed, drop them, because our position has been that there is no adequate evidence to charge Bernard Randall," Onyango said.
"We are concerned about his deportation on flimsy grounds... but we are not making an appeal because if doesn't serve much purpose," he added.
Randall dismissed the allegations against him as "lies".
Asked by AFP how he felt about the court decision, Randall, a widower with two grown-up daughters, said: "I don't know yet", adding: "But it is going to be great to finally go home. To see my family."
A former computer engineer from Kent in southeast England, Randall came out as a homosexual after his wife died just short of their 40th wedding anniversary. He first travelled to Uganda in 2011, and last year he settled in the Ugandan town of Entebbe on the banks of Lake Victoria.
Soon after, Randall says his home was robbed and his laptop, which contained images of him having sex with another man in Morocco, was stolen. The alleged thieves passed the images to Pastor Male, a prominent evangelical Christian and anti-gay campaigner, who then in turn gave them to Red Pepper, a tabloid newspaper.
The newspaper then sounded the alarm over Randall, prompting his arrest and trial. The Briton risked being jailed for up to two years, while his Ugandan friend was also arrested and faces the more serious charge of "gross indecency", and could be jailed for up to seven years.
Randall's friend, Albert Cheptoyek, said the deportation order was "not fair".
"I think they have deported him because he is gay. Because the government doesn't want gays. This is what the judge said, that we don't allow homosexuality in Uganda," he said, adding that he feared for his own fate.
"I'm scared. Mostly because I am staying in the country. I don't know if they will put me in prison. Because they (the prosecution) said that we are like husband and wife in the house. It is making me scared, because my case is still continuing," he added.
Homophobia is widespread in Uganda, where American-style evangelical Christianity is on the rise.
Gay men and women in the country face frequent harassment and threats of violence, and rights activists have reported cases of lesbians being subjected to "corrective" rapes.
In 2011, prominent Ugandan gay rights activist David Kato was bludgeoned to death at his home after another tabloid newspaper splashed photos, names and addresses of gays in Uganda on its front page along with a yellow banner reading "Hang Them".