The US has cut aid to Uganda, imposed visa restrictions and cancelled a regional military exercise in response to a Ugandan law that imposes harsh penalties on homosexuality.

The White House said the measures were intended to "reinforce our support for human rights of all Ugandans regardless of sexual orientation or gender identity".

Homosexuality is taboo in most African countries and illegal in 37, including in Uganda.

Uganda's new law imposes jail terms of up to life for "aggravated homosexuality", which includes homosexual sex with a minor or while HIV-positive.

The law also criminalises lesbianism for the first time and makes it a crime to help individuals engage in homosexual acts.

It was signed by President Yoweri Museveni in February and has been widely condemned.

Western donors had halted or redirected about $118m (€87m) in aid to the east African nation's economy before yesterday's announcement.

A Ugandan government official said the measures would not alter its decision to toughen laws against homosexuals.

"Uganda is a sovereign country and can never bow to anybody or be blackmailed by anybody on a decision it took in its interests, even if it involves threats to cut off all financial assistance," government spokesman Ofwono Opondo said.

US President Barack Obama previously told Mr Museveni the law would complicate relations between the two countries.

Since then the US has been reviewing its funding to Uganda, while privately pressing Mr Museveni's government to repeal the law.