Ugandan President Yoweri Museveni signs anti-gay bill
It includes life sentences for gay sex and same-sex marriage, but a proposed sentence of up to 14 years for first-time offenders has been removed.
US President Barack Obama had cautioned the bill would be a backward step.
Mr Museveni had previously agreed to hold it pending US scientific advice.
Homosexual acts are already illegal in Uganda.
Correspondents say Uganda’s inefficient parliamentary system has meant it has been difficult to get copies of the draft legislation.
The bill signed by Mr Museveni, and seen by the BBC, is significantly different to what was initially reported on Monday – and has been watered down, they say.
The new law allows life imprisonment as the penalty for acts of “aggravated homosexuality” and also criminalises the “promotion” of homosexuality”, where activists encourage others to come out.
Earlier drafts of the bill made it a crime not to report gay people – in effect making it impossible to live as openly gay – but this clause has been removed.
Homosexuality is just bad behaviour that should not be allowed in our society”
MP David Bahati
Lesbians are covered by the bill for the first time.
Gay activists say they will challenge the new laws in court.
The bill originally proposed the death penalty for some homosexual acts, but that was later removed amid international criticism.