ISTANBUL--Turkey's government has passed a controversial new security law, centralizing and expanding police powers amid widespread concerns the measures will be used to crack down on political dissent.

President Recep Tayyip Erdogan's ruling Justice and Development Party, or AKP, pushed the bill through on Friday after more than a month of debate delayed by opposition filibusters and lawmaker fistfights. Almost half of the original bill's 132 articles were scrapped, but key measures were preserved. Turkey's main opposition Republic People's Party has vowed to challenge it in the constitutional court.

The bill expands security forces' authority to fire live rounds on protesters if attacked by Molotov cocktails or other weapons. The new legislation also lets police search and detain people for up to 48 hours without judiciary authorization, allowing governors to bypass judges and prosecutors to order arrests. Protesters who cover their faces at violent protests will receive a mandatory four-year prison sentence.

Slammed for its draconian nature, the legislation provoked a strong reaction from a cross-party alliance of opposition lawmakers who argue the government is seeking to muzzle dissent and place security services in hock to the ruling party, rather than public safety.

Mr. Erdogan's deputies have argued that the steps are necessary to safeguard Turkey's political and economic stability after violent antigovernment demonstrations in early-October resulted in dozens of deaths in the country's majority Kurdish southeast.

After weeks of debate, turnout on Friday was low in the 550-seat parliament during the 16-and-a-half hour session, which concluded as 199 lawmakers voted in favor of the law and 32 against.

Write to Emre Peker at emre.peker@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires