Istanbul (AFP) - Turkish riot police in Istanbul on Sunday fired tear gas and rubber bullets to disperse protesters defying a ban on the city's Gay Pride parade.

Authorities in Turkey's biggest city banned the annual parade earlier this month over security concerns, sparking anger from gay rights activists.

Two German politicians -- Volker Beck, a prominent Green lawmaker and one of Germany's most vocal gay politicians, and Green MEP Terry Reintke -- were detained briefly, each said on Twitter.

Police at the scene -- who heavily outnumbered demonstrators -- said 12 people had been detained, an AFP photographer said. A freelance US photographer was among them.

Two or three hundred young protesters turned out despite the ban on the parade, which rights activists have been staging in Istanbul for the last 12 years.

Gathering in small groups around the busy Istiklal shopping street in a bid to evade the police, the demonstrators unfurled giant rainbow flags from windows several stories up.

"We're protesting spread-out, because the police are everywhere and blocking everything," said Gizem Seker, who had rainbows painted on her cheeks.

She added that this was also a tactic to avoid ultra-nationalists, who had demanded last week that authorities cancel the Gay Pride parade.

The far-right group had warned they would be sure to stop the parade if police did not heed the call.

Police moved swiftly to disperse the protesters, firing tear gas and rubber bullets and confiscating their rainbow flags, an AFP correspondent witnessed.

- 'Love will win' -

"What bothers the government is the visibility of the LGBT (Lesbian, Gay, Bisexual and Transgender) community," said Irem, another young protester.

"They don't want people to see us. And to be visible, rather than a march we have chosen to be here, on every corner of the street," she told AFP.

"And I think we've succeeded -- we've spread ourselves out and love will win, I'm sure of it."

Turkish police have cracked down heavily on even small demonstrations since major anti-government protests in Istanbul in 2013.

Story continues

A week ago, hundreds of riot police used tear gas and rubber bullets to stop Istanbul's "Trans Pride" event taking place during Ramadan.

It was the latest police crackdown against an event during the Muslim holy month, with critics claiming the Islamic-rooted government is undermining Turkey's secular tradition.

Istanbul authorities said Sunday's rally was banned to "safeguard security and public order" after a string of bombings around Turkey over the past year.

Some of these attacks have been blamed on the Islamic State group, others claimed by Kurdish militants.

In previous years, thousands of people have taken part in Istanbul Pride, the most important LGBT gathering in a Muslim country in the region.

Organisers blasted the ban on this year's event in a statement that they tried to read aloud at the protest before they were dispersed.

"We will always exist, shout out our existence, and always be proud of our existence," the statement said.

"They are right to be afraid of us because we are uniting, growing, and marching."