Turkish police fired rubber bullets in an attempt to break up a gay pride parade in Istanbul on Sunday, witnesses said.

The march had been banned by Istanbul's governor, who cited security concerns after threats from an ultra-nationalist group.

Open gallery view A plain-clothes police officer kicks a member of a group of LGBT rights activist as police prevent them from going ahead with a Gay Pride parade, Istanbul, June 25, 2017. Credit: BULENT KILIC/AFP

Open gallery view A Turkish police officer stands with his dog as they prevent LGBT rights activists from going ahead with a Gay Pride annual parade in Istanbul, June 25, 2017. Credit: BULENT KILIC/AFP

Police with riot shields and helmets sealed off entrances to Istiklal Street, where organizers had planned to hold the march before authorities announced the ban.

Small groups of people gathered in side streets waving rainbow flags, symbols of lesbian, gay, bisexual and transgender pride.

Footage posted on the internet appeared to show police firing tear gas and nationalists were seen clashing with LGBT activists. Several people were detained.

Open gallery view Turkish nationalists confront LGBT rights activist who are trying to go ahead with a Gay Pride annual parade in Istanbul, June 25, 2017. Credit: BULENT KILIC/AFP

It was the second year running that Istanbul's LGBT march, described in the past as the biggest in the Muslim world, was blocked by city authorities.

The ultra-nationalist Alperen Hearths group threatened last week to prevent the march if authorities did not act, and the governor's office said on Saturday that it took its decision out of concern for the security of marchers, tourists and residents.

March organizers said the ban was effectively legitimizing what they called the hate crimes of groups like Alperen Hearths, and urged the governor to reverse the decision.

"The true reason for the reactions towards a march that took place in peace for 12 years is hate," organizers said.

"Our security cannot be provided by imprisoning us behind walls, asking us to hide," they added. "Our security will be provided by recognizing us in the constitution, by securing justice, by equality and freedom."

Istanbul has traditionally been seen as a relative safe haven by members of the gay community from elsewhere in the Middle East, including refugees from Syria and Iraq.

But although homosexuality is not a crime in Turkey, unlike many other Muslim countries, homophobia remains widespread. Critics say Turkish President Tayyip Erdogan and his Islamist-rooted AK Party have shown little interest in expanding rights for minorities, gays and women, and are intolerant of dissent.