Image caption Many activists held pink umbrellas to shade them from the hot sun

Thousands have attended an annual Singaporean gay rights rally, which foreigners are now banned from attending under new laws.

Only citizens and permanent residents are allowed at the event, which has come under growing restrictions.

Estimates suggested the number of those attending had dropped slightly - but organisers said the event was still over capacity.

Gay sex is illegal in socially conservative Singapore.

Previous Pink Dot rallies have been open to everyone. But because it is illegal for foreigners to take part in political protests in Singapore, they were technically there only as observers.

Organisers said 20,000 Singaporeans and residents attended - compared with 25,000 or more in previous years.

However, that did not include any foreigners restricted to the sidelines, or those who could not pass the security barriers after the park reached capacity.

Image copyright Pink Dot Image caption Attendees formed the titular "pink dot" - complete with rainbow - as night fell

Long queues were seen snaking around Hong Lim Park, as participants lined up for security pat-downs and identity card checks.

"Even with this restricted space that limits Singapore's true propensity for love, we feel that we have taken yet another important step in achieving true equality for all," spokesperson Paerin Choa said.

Partying in pink - Tessa Wong, BBC News, Singapore

The new rules appeared to do little to dampen the festive mood at Pink Dot, as thousands dressed in pink crammed into tiny Hong Lim Park to picnic and listen to speeches.

Dozens more were standing beyond the barricades, quietly watching the party. They included Martin, a German, and Kian, a Singaporean. Only Kian was allowed to enter, so the couple decided to stay together on the sidelines.

"This event is about anti-discrimination but because of the rules they have to keep out foreigners. I feel that's silly," said Martin.

Some attendees, like Singaporean participant Jinesh Lalwani, believed there was a silver lining to the increased restrictions.

"It's galvanised locals to turn up. That's important because some believe foreign forces are behind the gay rights movement here. So this event shows there's actually strong Singaporean support," he said.

Recent changes to Singapore's laws classify anyone attending the event as a participant so organisers announced in May that they had no choice but to bar foreigners altogether.

Authorities said the restrictions apply to all political events, not just Pink Dot, and are necessary to prevent foreign involvement in domestic socio-political causes.

But several gay-friendly bars in the city organised alternate events, with live screenings of Pink Dot, to host foreigners.

Foreign companies such as Google and Goldman Sachs, which had previously given funding, have also been banned from sponsoring the event this year. This prompted about 100 local firms to step in to provide sponsorship.

Pink Dot, which has been held annually in a small park since 2009, has grown significantly over the years and has sparked a backlash among conservatives.

Media playback is unsupported on your device Media caption Singapore's gay rights rally has come under increased restrictions

In 2014, religious groups held a counter-campaign called Wear White.

The gay rights movement has gained significant momentum in some parts of Asia.

In May, a Taiwanese court ruled in favour of gay marriage, paving the way for Taiwan to become the first place in Asia to legalise same-sex unions.