An angry crowd has attacked the Ankara headquarters of Turkey's main pro-Kurdish party, in a night of nationalist violence across the country.

The demonstrations on Tuesday came after several deadly attacks - attributed to the Kurdish armed group PKK - against Turkish soldiers and police officers.

Dozens of nationalist protesters marched on the headquarters of the pro-Kurdish Peoples' Democratic Party (HDP) in Ankara on Tuesday evening, throwing stones and ripping down the sign outside, witnesses said.

"Our headquarters in under attack but the police is not performing its duties," the party said on its official Twitter feed.

Smoke was seen coming from the building, an AFP news agency photographer said, although police eventually dispersed the demonstrators.

Pictures posted on social media suggested the interior of the building had been badly damaged in the attack with some offices completely gutted by fire.

Nationalists accuse the HDP of being the political wing of the armed group Kurdistan Workers' Party (PKK), which has carried out a series of deadly attacks that have killed dozens of members of the security forces in recent days.

The HDP denies this is the case.

In the southern resort city of Alanya, the local HDP headquarters was set on fire, sending yellow flames into the night sky, CNN-Turk reported.

Reports said 2,000 people carrying the Turkish flag had marched on the building, with the fire eventually doused by the fire brigade.

Rising tension

Similar nationalist demonstrations were taking place across Turkey, with protesters damaging HDP buildings in at least six other cities, it said.

The attacks come amid rising tensions in Turkey and warnings that the country is on the verge of a protracted civil conflict with its Kurdish minority.

The violence against the HDP also came as the headquarters of Turkish newspaper Hurriyet in Istanbul were attacked for the second time in three nights.

Demonstrators shouted nationalist slogans during a protest in front of the headquarters of the Hurriyet newspaper in Istanbul [Reuters]

Windows were smashed and the building pelted with stones until the riot police finally arrived, the paper said.

In a series of tweets urging calm, Prime Minister Ahmet Davutoglu condemned the damage inflicted on newspapers and political party headquarters as "unacceptable".

"No one should put themselves above the law," he said.

Davutoglu said military operations against the PKK would continue "with determination" but people should not take matters into their own hands.

"We will not allow brothers to fight each other," he said, calling on Turks to be "calm and have confidence in the state".

Meanwhile, Turkish internet users reported they were unable to access Twitter inside the country, a measure frequently used by the authorities in times of crisis.