A Ugandan court has ordered the deportation of a British man facing criminal charges related to images of him having sex with another man.

A lawyer for Bernard Randall said on Wednesday that prosecutors were using the excuse of an expired visa to seek Randall's deportation after failing to find evidence against him in the criminal case. Lawyer Francis Onyango said his client traveled to Uganda on a tourist visa that expired after his passport was stolen.

Jane Kajuga, a spokeswoman for Uganda's directorate of prosecutions, said prosecutors dropped the case but did not explain why.

Randall, 65, will likely be flown out of the country on Thursday after a magistrate ordered his immediate deportation, police commander Edgar Nyabongo told the Associated Press news agency.

The Briton was charged last year with trafficking in obscene material. His laptop computer was stolen from his home and photos on the computer showing him have sex with another man were sent to a Ugandan newspaper that published them. That led to the charges.

Randall will be the second foreigner deported from the East African country over alleged homosexual offenses. Last year the British producer of a gay-themed play was deported after being jailed for staging the play without official authorisation. Such authorisation is not usually required to stage a play.

Homosexuality is illegal in Uganda, where lawmakers last month passed a new bill that prescribes life imprisonment for "aggravated'' homosexual acts. The bill, which appears to have wide support among Ugandans, has been opposed by the president, who says it is too harsh and has yet to sign it into law. Rights groups have condemned it as draconian.