Turkish riot police in Istanbul fired tear gas and water cannon Saturday at around 3,000 people protesting new legislation tightening control of the Internet.

Police took action to push protesters away from the city's Taksim Square, a focal rally point, an Agence France Presse reporter said.

Protesters responded by hurling fireworks at police, who detained dozens of people, according to media reports.

"Government, resign!" the demonstrators chanted. "Do not touch my Internet!"

"Everywhere is Taksim, everywhere is resistance," they shouted, echoing a chant often heard during the huge anti-government protests that swept the country in June.

The controversial law came into effect last Wednesday after it was signed by Turkish President Abdullah Gul despite repeated calls for a veto.

It gives the telecoms authority the power to order a webpage blocked if the content is deemed to infringe privacy or is offensive.

The new curbs have sparked alarm at home and abroad, with critics saying they are an attempt to stifle dissent and stop evidence of high-level corruption being seen online.

Earlier Saturday, Prime Minister Recep Tayyip Erdogan again denied accusations of online censorship, to a crowd of several thousand supporters in the city of Sivas.

"We are not against the Internet, we are against the 'immoral' items on the Internet," Erdogan said at a rally marking the kick-start of his party's local election campaign.

"We have just taken steps to prevent our children from being poisoned," he said.

The legislation came as Erdogan deals with a wide-ranging graft scandal that erupted in mid-December, implicating his inner circle.

The embattled premier has accused U.S.-exiled Muslim cleric Fethullah Gulen, whose supporters hold key positions in the police and the judiciary, of instigating the probe ahead of local polls on March 30.

His government has taken a series of retaliatory measures, including a mass purge of police and prosecutors and legislation reforming the judiciary.

But these measures, coupled with a heavy-handed police crackdown on the June protests, have severely dented Turkey's image as a model of democracy and stability in a volatile region.