ENTEBBE, Uganda – Scores of Ugandan homosexuals marched through sprawling botanical gardens in the lakeside town of Entebbe on Saturday, their first pride parade since a Ugandan court invalidated a controversial anti-gay law.

Many marchers wore masks, signaling they did not want to be publicly identified in a country where homosexuals and their supporters face severe discrimination.

Although organizers had expected more than 500 people to attend the event, fewer than 200 turned up, said gay activist Moses Kimbugwe, who noted that many were afraid of possible violence following a court’s decision earlier this month to jettison an anti-gay law that had wide support among Ugandans.

“We are here to walk for those who can’t walk, who are afraid to walk,” said Kimbugwe. “We are here to celebrate our rights.”

Uganda’s Constitutional Court ruled last week that the anti-gay law enacted only five months ago was illegal because it was passed during a parliamentary session that lacked a quorum.

Some lawmakers have pledged to try to reintroduce the same legislation when parliament emerges from a recess later this month. They said they would try to pass the same law in parliament since it had been invalidated on technical grounds and not its substance.

On Saturday, activists held up placards saying they would not give up the fight for gay rights in this conservative East African country of 36 million people. Some waved rainbow flags as they danced and frolicked on a sandy beach on the shores of Lake Victoria, about 25 miles from the capital, Kampala.

This was the third annual gay pride event, organizers said. The first one, in 2012, turned violent after local police tried to break it up, said Ugandan lesbian activist Jacqueline Kasha. This time they had been given assurances by the police that they could go ahead with the march, she said.

“We are a group of people who have suffered enough,” she said. “We are Ugandans who have the right to gather in a public place … and we are going to have fun.”

Homosexuals face threats including evictions by landlords and many have fled to neighboring countries such as Kenya, where the anti-gay sentiment is less pervasive, according to Ugandan rights activists. Many homosexuals are victims of extortionist campaigns by people who threaten to reveal their homosexuality to the police, said Kasha, the lesbian leader.