Turkey's prime minister has brushed off criticism by human rights groups and some European countries, insisting police officers have displayed "legendary heroism" in quelling weeks of anti-government protests.

Addressing police academy graduates at a ceremony in Ankara Monday, Recep Tayyip Erdogan said it was protesters — not police — that were violent, and praised the security forces for showing restraint.

The protests started off as a small environmental sit-in but quickly turned into a nationwide expression of discontent with Erdogan's 10-year rule.

Erdogan has blamed the demonstrations on a foreign conspiracy to harm Turkey.

At least four people — three demonstrators and one police officer — have been killed. Human rights groups say police used excessive force on protesters.