Uganda's president has refused to approve a controversial bill that would see homosexuals jailed for life, saying there were better ways to "rescue" people from their "abnormality".

In a letter to parliament, Yoweri Museveni said gays would go "underground and continue practicing homosexuality or lesbianism for mercenary reasons", according to the independent newspaper, Daily Monitor.

The anti-gay bill passed through the Ugandan parliament last month after its architects agreed to drop a death penalty clause.

"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 writing in a letter to parliament.

He said that homosexuality was caused by either "random breeding" or a need to make money.

And lesbians, he said, chose female partners because of "sexual starvation" and the failure to marry a man. But he said improving the nation's economy would stop people becoming gay.

Museveni continued: "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".

Gay men and women in Uganda face frequent harassment and threats of violence, and rights activists have also 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 a newspaper splashed photos, names and addresses of gays 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 gays 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.