An asylum seeker from Uganda covers his face with a paper bag in order to protect his identity as he marches with the LGBT Asylum Support Task Force during the Gay Pride Parade in BostonReuters file photo

Uganda's constitutional court has declared the country's anti-gay law, which sparked a global outcry, as "null and void" due to flaws in its enactment.

According to the quashed Anti-Homosexuality Act, those found guilty would face up to life term in prison. The law also allowed anyone who is "aiding and abetting homosexuality" to be jailed for seven years.

"I can confirm the anti-homosexuality law has been struck down. The judge said there were irregularities in the process of its enactment and also there was no quorum in parliament," Nicholas Opio, a lawyer representing the petitioners, told reporters following the verdict.

One of the petitioners, Andrew Mwenda, said: "The retrogressive anti-homosexuality act of Uganda has been struck down by the constitutional court - it's now dead as a door nail."

LGBT supporters and activists who were at the court cheered as soon as the judgment was pronounced. Opposition parties have said they will appeal against the verdict in the supreme court.

The law, which came into force in February, invited condemnation from across the globe, especially the western world.

Some countries went to the extent of withholding aid to Uganda over the draconian law.

Rights groups and the UN have welcomed the court decision.

"The secretary-general welcomes the decision by the constitutional court of Uganda to annul the country's anti-homosexuality act as a victory for the rule of law.

"He pays tribute to all those who contributed to this step forward, particularly the human rights defenders in Uganda who spoke out, at times incurring great personal risk," UN spokesperson Stephane Dujarric said in a statement.