He said seven foreign suspects 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 the final day of a north African tour that has been overshadowed by the unrest back home.
"Supporters of this terrorist organisation were present" in Istanbul's Taksim Square, epicentre of the protests, he added.