ANKARA (Reuters) - Turkey’s parliament overwhelmingly passed a security law on Friday to broaden police powers and allow the use of firearms against demonstrators, deepening fears of crackdowns on dissent ahead of parliamentary elections.

Turkey's President Tayyip Erdogan takes part in a welcoming ceremony in Kiev March 20, 2015. REUTERS/Gleb Garanich

The legislation comes at a sensitive time, given difficult talks to end three decades of Kurdish insurgency. The Kurds say the security law could be used to target them.

Parliament also passed a law that would allow government to restrict access to websites deemed to threaten lives, public order or people’s freedom.

Ankara has said its reforms bring police powers into line with those of Europe, although this is disputed by rights groups. Critics say freedom of speech is threatened by the AK Party founded by President Tayyip Erdogan.

The main opposition Republican People’s Party (CHP) said it would launch a constitutional court challenge to the security law before the June 7 elections.

The legislation gives police greater power for searches, bans the carrying of fireworks, marbles and slingshots and stipulates up to five years in prison for those who cover their faces at some protests.

For critics, the law is seen as government retaliation to recent deadly violence in the mainly Kurdish southeast.

It could also be an attempt to win nationalist voters opposed to the peace process, said Anthony Skinner, a director at risk consultancy Verisk Maplecroft.

“Providing the police with even greater impunity and encouraging them to resort to disproportionate violence is hardly conducive to building trust and moving the peace talks forward,” he said.

“LAW HAS COME LATE”

The government withdrew the security bill last month after unruly parliamentary debates descended into brawls. The slimmed-down version, which retains the key security measures, passed by a margin of 199 to 32.

It will now be sent to Erdogan, who is widely expected to approve it. He underlined his support for tough security in a recent speech, blaming unrest on Kurdish politicians.

“They called the people onto the street in October. They burned and destroyed houses and cars,” he said. “Toys which kill people were taken from their hands. These should be crimes. This law has come late.”

Erdogan brooks little dissent and dozens have faced legal action for insulting him, including a 13-year-old for a Facebook post.

He wants the AK Party to win a two-thirds majority in June to allow it to change the constitution and create a full presidential system.

CHP politician Hursit Gunes said on Thursday the law risks stirring tensions with the Kurds.

The legislation could be used to clamp down on Kurdish protests in the event the pro-Kurdish HDP party fails to attract the minimum 10 percent of the vote to enter parliament, he said. The HDP’s support is currently close to the threshold.

“Assume the HDP cannot pass the 10 percent election barrier. There will be a lot of tension in southeastern Turkey. The government will be very brutal in response, this bill will help them do that.”

Additional reporting by Daren Butler; Editing by David Dolan and Toby Chopra