In a letter to parliament, the president said homosexuality was caused by either "random breeding" or a need to make money. Lesbians, he said, chose female partners because of "sexual starvation" and the failure to marry a man.

But the best way to deal with homosexuality was to improve the African country's economy, he said in the letter published on Friday in Kampala's Daily Monitor newspaper. Sarah Kagingo, a spokeswoman for the presidency, confirmed that Museveni had written the letter.

"The question at the core of the debate on homosexuality is what do we do with an abnormal person? Do we kill him/her? Do we imprison him/her? Or we do contain him/her?" the president was quoted as saying.

"Even with legislation, they will simply go underground and continue practising homosexuality or lesbianism for mercenary reasons," he said.

Although he has refused to sign off on the legislation, Museveni's homophobic comments could be seen as a way to avert criticism that he is supporting gay people.

"You cannot call an abnormality an alternative orientation. It could be that the western societies, on account of random breeding, have generated many abnormal people," he said, adding that other people became gay for "mercenary reasons", or, in the case of lesbians, a lack of sex with men.

The report said the president believed that improving Uganda's economy – including rapid industrialisation and modernising agriculture – was the best way to "rescue" young people from the risk of "disgusting behaviour".

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 also reported cases of lesbians being subjected to "corrective" rapes.

In 2011, the prominent Ugandan gay rights activist David Kato was bludgeoned to death at his home after a newspaper splashed photos, names and addresses of gay people in Uganda on its front page along with a yellow banner reading: "Hang them."

Aids activists say that if passed the bill would have prevented gay people from having access to essential public health information, such as how to protect themselves from HIV and how to access life-saving treatment and support services.