(Adds Pride Week Commission statement)

By Ece Toksabay and Dasha Afanasieva

ANKARA, June 17 (Reuters) - Authorities in Istanbul have banned transgender and gay pride marches this month, citing security concerns after ultra-nationalists said they would not allow "degenerates" to hold the events on Turkish soil.

The organisers of the events, the Pride Week Commission, said the ban was illegal and that it would take legal action.

A march in support of transgender people was planned for Sunday in central Istanbul, while an annual gay pride parade - described in the past as the biggest in the Muslim world - had been due to take place a week later on June 26.

The Istanbul governor's office said on Friday the marches had been banned out of concern for public order. Security in the city is already tight after a series of bombings blamed on Islamic State and Kurdish militants in recent months.

But the ban also follows a warning from an ultra-nationalist youth group, the Alperen Hearths, that it would not allow the marches, calling them immoral and threatening violence.

"To our state officials: do not make us deal with this. Either do what is needed or we will do it. We will take any risks, we will directly prevent the march," the group's Istanbul provincial head, Kursat Mican, told journalists on Wednesday.

"Degenerates will not be allowed to carry out their fantasies on this land ... We're not responsible for what will happen after this point," he said, citing a Turkish proverb: "if you're not taught by experience, you're taught by a beating."

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

There had already been concerns about the security of the planned marches after last weekend's massacre at a gay nightclub in Florida of 49 people by a gunman who had expressed sympathy for a variety of Islamist militant groups.

Yeni Akit, a religiously conservative newspaper loyal to the Turkish government, ran a headline the next day saying "50 pervert gays killed in a bar".

Historically the gay pride parade in Istanbul - a city seen as a relative safe haven by members of the gay community from elsewhere in the Middle East, including refugees from Syria and Iraq - has been a peaceful event.

But last year police used tear gas and water cannon to disperse participants, after organisers said they had been refused permission because it coincided with the holy month of Ramadan, as it does again this year.

"Last year's ban caused tens of people to be injured. The violence incurred is on record and has received worldwide attention," the Pride Week Commission said in its statement. (Editing by Nick Tattersall/Mark Heinrich)

Our Standards: The Thomson Reuters Trust Principles.