Turkey's state-run agency says police have raided homes in the capital Ankara, detaining at least 20 people involved in anti-government protests.

The Anadolu Agency said Tuesday that police searched some 30 addresses and rounded up 20 people with alleged links to "terror" groups and suspected of "attacking police and the environment" during nearly three weeks of protests that swept Turkey.

The protests began in Istanbul on May 31 and quickly turned into widespread demonstrations against Prime Minister Recep Tayyip Erdogan's leadership following a heavy-handed police clampdown on peaceful activists. The demonstrations turned violent at times, and Erdogan has accused terrorist groups of involvement.

Late on Monday, thousands in Istanbul protested a court decision that released a police officer from custody pending trial for the killing of a demonstrator.