Uganda has hosted its first gay pride rally since a draconian anti-homosexuality law was overturned by the courts.

Sandra Ntebi, organiser of the rally held on Saturday in Entebbe, 35km from the capital Kampala, said police had granted permission for the invitation-only "Uganda Pride" event.

"This event is to bring us together. Everyone was in hiding before because of the anti-homosexuality law," she said. "It is a happy day for all of us, getting together."

The overturned law, condemned as "abominable" by rights groups but popular among many Ugandans, called for proven homosexuals to be jailed for life.

The constitutional court rejected the law on a technicality on 1 August, six months after it took effect. The government swiftly filed an appeal, while MPs have signed a petition for a new vote on the bill.

Homosexuality remains illegal in Uganda, punishable by a jail sentence. However, it is no longer illegal to promote homosexuality and Ugandans are no longer obliged to denounce gays to the authorities.

Amid music, dancing and laughter, activists gathered in a park on the shores of Lake Victoria, close to the country's presidential palace. "Some Ugandans are gay. Get over it," read one sticker a man had pasted onto his face.

Ugandan deputy attorney-general Fred Ruhinda said that government lawyers had lodged an appeal against the ruling at the supreme court, the country's highest court.

"We are unsatisfied with the court ruling," he said. "The law was not intended to victimise gay people, it was for the common good."

In their surprise ruling last week, judges said it had been passed without the necessary quorum of MPs in parliament.

Rights groups said the law triggered a sharp increase in arrests and assaults on members of the country's lesbian, gay, bisexual and transgender community.

Homophobia is rampant in Uganda, where American-style evangelical Christianity is increasingly popular.

Gay men and women face frequent harassment and threats of violence, but activists celebrated openly on Saturday.

"Since I discovered I was gay I feared coming out, but now I have the courage after the law was thrown out," said Alex Musoke, one of more than 100 people at the event.

One pair of activists waved a rainbow flag with a slogan appealing for people to "join hands" to end the "genocide" of homosexuals. There were few police in attendance and no protestors.

Critics said President Yoweri Museveni signed the law to win domestic support ahead of a presidential election set for 2016, which would be his 30th year in power.

However, it lost him friends abroad, with several international donors freezing or redirecting millions of dollars of government aid, saying the country had violated human rights and democratic principles.

US secretary of state John Kerry likened the law to antisemitic legislation in Nazi Germany.

Analysts suggest that Museveni secretly encouraged last week's court ruling as it provided a way to avoid the appearance of caving in to foreign pressure.

Gay rights activists say the battle is not over. MPs have signed a petition calling for a new vote on the bill and to bypass parliamentary rules that require it be formally reintroduced from scratch – a process that could take years.