By Daren Butler

ISTANBUL (Reuters) - Turkish police detained 17 suspected militants in a sweep in Istanbul on Thursday that included a raid on offices of the pro-Kurdish Peoples' Democratic Party (HDP), state media said, hours after twin bomb attacks hit the mainly Kurdish southeast.

Security sources blamed Kurdistan Workers Party (PKK) militants for the bombings on Wednesday evening, which killed nine civilians and came as Turkey is in the midst of a crackdown after a failed military coup attempt on July 15.

Backed by a helicopter, counter-terror squads raided HDP offices in Istanbul's central Beyoglu district at 3 a.m. (0000 GMT) as armoured vehicles were deployed nearby, the Dogan news agency reported.

The HDP, parliament's third-largest party, wrote on its Istanbul Twitter account that police had broken open the door of its building and "illegally" searched the offices when no party official was present.

The raids, in 10 districts across Turkey's largest city, targeted the "urban structure" of the PKK, Anadolu said. It said the detainees were accused of "terror group membership", recruitment and staging illegal protests.

A 2-1/2 year ceasefire between Turkey and the PKK fell apart last year, triggering some of the worst violence in the southeast since the group launched its insurgency in 1984.

Bomb blasts in two cities in southeast Turkey killed nine civilians and wounded dozens on Wednesday evening, according to the security sources.

A top PKK commander had warned at the weekend of fresh attacks, saying police "will not be able to live as comfortably as they did in the past in cities."

"The war will from now on be conducted everywhere without distinguishing between mountains, valleys and cities," the PKK's Cemil Bayik said in an interview published by the Firat news agency, which is close to the group.

Wednesday's bomb attacks, in the southeast's largest city Diyarbakir and in the Kiziltepe area of Mardin province, were condemned by the HDP in a statement on Wednesday evening.

"We repeat our call for the bloodshed and violence to be halted immediately and for steps to be taken to solve our problems by talking and negotiations," it said.

HDP leader Selahattin Demirtas subsequently said Bayik's statement was wrong and called for the PKK to boost its efforts for peace.

President Tayyip Erdogan accuses the HDP of being a political extension of the PKK and has spearheaded a parliamentary move to lift the immunity from prosecution of HDP deputies.

The HDP denies direct links with the autonomy-seeking PKK and promotes a negotiated end to the insurgency that has killed 40,000 people, mostly Kurds. The PKK is designated as a terrorist organisation by Turkey, the European Union and the United States.

(Writing by Daren Butler; Editing by Patrick Markey and Raissa Kasolowsky)