He said seven foreigners implicated in the unrest had been arrested.
" Among the protesters, there are extremists, some of them implicated in terrorism, " Erdogan told reporters in Tunis on Thursday, on the final day of a north African tour that has been overshadowed by the unrest back home.
" Supporters of this terrorist organization were present " in Istanbul ' s Taksim Square, epicenter of the protests, he added.
He did not specify the nationalities of the detained foreigners or where they had been arrested, but he denied that any of them were diplomats, in response to a Turkish journalist ' s question.
" Seven foreigners have been implicated in the unrest, six of whom have appeared before the public prosecutor and one of whom is under arrest. "
" An inquiry is taking place to determine the manner in which they took part in the violence, " the prime minister said.
Since last weekend, thousands of angry demonstrators opposed to the conservative policies of Erdogan ' s Justice and Development Party(AKP) have taken to the streets of Turkey ' s main cities calling for him to quit.
A heavy - handed police response to a peaceful demonstration against the redevelopment of Istanbul ' s Gezi Park next to Taksim Square was the initial spark for the nationwide unrest that has now claimed three lives.
Erdogan has previously defied the protesters, dismissing them as " extremists. "
" We will not allow a minority to dictate to the majority, nor will we accept the tyranny of the majority, " he said on Thursday, while defending the urban development plan.
" We will go through with this project…(which) respects(Turkey ' s) history, culture and environment. "
The embattled premier was due back in Turkey later on Thursday after his four - day trip, which also took him to Morocco and Algeria.
The mass unrest at home has only intensified in his absence, with doctors reporting thousands of injured as police tried to quell the rallies in major cities with tear gas, pepper spray and water cannon.