Turkish prosecutors launched a probe Thursday into pro-Kurdish leader Selahattin Demirtas after he condemned the detention of two mayors of the country's biggest Kurdish city.

Gultan Kisanak and Firat Anli, co-mayors of the southeastern city of Diyarbakir, were taken into custody Tuesday as part of a "terrorism" probe, accused of having links to Kurdish separatists.

The Diyarbakir prosecutor said in a statement the investigation into Demirtas, co-chairman of the pro-Kurdish Peoples' Democratic Party (HDP), will look into whether he insulted President Recep Tayyip Erdogan in a speech on Thursday.

The probe will also investigate whether he "incited people to disobey the law", "publicly humiliated the Turkish Republic and the state's judicial institutions" as well as "praised crime and criminals".

In a speech outside the Diyarbakir town hall, Demirtas called on the prosecutor to prove the mayors' "terror links".

"No one can accuse our municipalities of giving support to weapons, terror and violence... If you can prove a penny went (to the outlawed PKK), let's see it. These are all lies."

Anli and Kisanak are also accused of making speeches in support of the rebel Kurdistan Workers' Party (PKK), proscribed as a terrorist organisation by Turkey, the European Union and the United States.

They are also alleged to have allowed the use of municipal vehicles for the funerals of PKK members.

"Until our municipality leaders can return to work, there will be resistance, there will be a struggle," he vowed, according to a write-up of his speech by the HDP.

Demirtas said the two municipality leaders were not terrorist supporters but accused Turkey of having "supported terror" by "nourishing" the Islamic State group and the Al-Qaeda-linked Nusra Front. Ankara strongly denies such claims.

Demirtas, a former lawyer, also criticised the public prosecutor. "We are against those prosecutors acting with the palace perspective," referring indirectly to Erdogan.

"What kind of prosecutor are you? No one acts more unlawfully than you."