ISTANBUL — Turkey’s Parliament passed one of its most contested pieces of legislation on Friday, a bill that broadens police powers and increases penalties for people participating in unauthorized demonstrations.

Approval came after a monthlong debate in which cups and glasses were flung across the assembly floor and lawmakers on opposing sides brawled with their fists over the bill. Supported by the ruling Justice and Development Party, which holds the majority of seats, the bill is expected to be signed into law by President Recep Tayyip Erdogan.

Under the bill, the police will be permitted to use firearms against demonstrators who are armed with firebombs or other “injurious or similar weapons.” They will also be able to detain people for up to 48 hours to uphold public order. Protesters wearing masks or partly covering their faces will face up to five years in prison if they are deemed to be spreading “propaganda for a terrorist organization.”

The bill will also allow the police to pursue some investigations without authorization from prosecutors and judges, raising fears of the arbitrary use of power without judicial oversight.