DIYARBAKIR, Turkey (Reuters) - Turkish police in the mainly Kurdish city of Diyarbakir on Wednesday used tear gas and water cannon to scatter protesters following the arrest of the city's popular two joint mayors for alleged links to terrorism.

Gultan Kisanak, a member of parliament before becoming Diyarbakir's first female mayor in 2014, and Firat Anli, her co-mayor, were detained late on Tuesday as part of a security crackdown after more than a year of violence in the region.

President Tayyip Erdogan has said the removal of elected officials and civil servants who are accused of links to the Kurdistan Workers Party (PKK), listed as a terrorist group by Turkey, the United States and the European Union, is integral to Ankara's battle against the armed group.

Kisanak, 55, is a prominent Kurdish political figure in Turkey and abroad. The European Union's foreign policy chief, Federica Mogherini, and EU Enlargement Commissioner Johannes Hahn described the arrests as "very worrying".

"It is always essential that all steps are taken in full respect of the rule of law, due process and fundamental freedoms - all commitments Turkey has made as a candidate country (seeking EU membership)," Mogherini and Hahn said in a statement.

Police in Diyarbakir dispersed a crowd of 300 people and detained more than two dozen protesters outside City Hall, a Reuters witness said. A few hours later, a crowd of about 1,000 people had re-formed and included pro-Kurdish parliamentarians.

Witnesses reported widespread Internet outages in Diyarbakir, a city of 1.7 million people.

The local prosecutor said Kisanak and Anli had given speeches sympathetic to the PKK, called for greater political autonomy for Turkey's estimated 16 million Kurds, and incited violent protests in 2014.

The autonomy-seeking PKK took up arms in 1984, and more than 40,000 people have died. Violence flared anew in July 2015 after a fragile ceasefire and slow-moving peace talks collapsed.

Erdogan accuses Kisanak's Democratic Regions Party (DBP) and its larger sister party, the Peoples' Democratic Party (HDP), parliament's third-biggest grouping, of links with the PKK. Both parties deny this, saying they are working for a peaceful settlement of the Kurdish issue.

The DBP, which dominates the southeast, fields a male and female for mayor to promote gender equality, although the Turkish state only recognizes one of the mayors.

Ankara appointed new administrators in two dozen Kurdish-run municipalities in September after removing their elected mayors over suspected links to militants.

A few hours before her arrest, Kisanak testified before a parliamentary commission looking into the failed military coup on July 15. HDP lawmakers walked out of the coup commission on Wednesday to protest at Kisanak's detention, accusing members of Erdogan's AK Party of "ordering" her arrest.

(Writing by Ayla Jean Yackley; editing by Mark Heinrich)