NAIROBI, Kenya -- Fistfights and scuffles broke out in Kenya's parliament Thursday as legislators passed a controversial security measure which the government says will help fight terrorism but which critics say are meant to silence dissent by curtailing civil liberties.

Opposition legislators threw the papers on the floor and chaos erupted in which government supporters hit and tore the clothes of opposition senator Johnston Muthama, who was seated in the public gallery.

"This is un-parliamentary ... we can't have such kind of violence in a respected house," Muthama said, pointing to his torn clothes after recording a statement at the parliament police station.

The ruckus was broadcast on national television. More chaos erupted again in the afternoon after parliament twice adjourned in the morning. Legislators threw water at the Deputy Speaker Joyce Laboso and books at speaker Justin Muturi. The new legislation was passed by acclamation amid shouting and throwing. Muturi was protected by a group of orderlies who surrounded the speakers' seat. The broadcast of parliament was stopped and journalists were barred from covering the vote.

"We will move to court to challenge the constitutionality of this law," Senate Minority leader Moses Wetangula said. "It is illegal, we will challenge it."

The Security Laws Bill passed by parliament made changes to 21 laws touching on security.

There was a heavy police presence in the city centre which was increased following the fracas in parliament. Police fired warning shots in another part of the capital where pro-opposition youths had blocked the road. Eight peaceful protesters demonstrating their opposition to the new law were arrested outside parliament buildings, according to activist Boniface Mwangi.

President Uhuru Kenyatta had urged parliament to pass the measure saying it will strengthen security following a series of terrorist attacks blamed on the Somali Islamic extremist group al-Shabab.

Nine western governments, including the United States and Britain had urged Kenyan legislators to respect human rights while enacting the legislation.

The new law had been opposed by the media, human rights groups and the main opposition coalition which say it will restrict freedoms. Opposition legislators say the new law will infringe on civil liberties reminiscent of the autocratic regimes of Kenya's first two presidents; President Jomo Kenyatta-- the father of Kenya's current president-- and Daniel Arap Moi.

Among the changes government has proposed in the security law is a fine of $56,000 or a three-year jail-term or both on journalists whose stories are deemed to undermine terror investigations, a similar fine for media which publish pictures of terror victims without the permission of the police.

While opposing the legislation Human Rights Watch and Amnesty International said in a joint statement Sunday the law will significantly expand the powers of intelligence officers.

Such powers were withdrawn in the 1990s after the then-Special Branch, now the National Intelligence Service, was accused of the torture of political activists and of detaining them for several years without trial, the international rights groups said.

The new law gives powers to intelligence officers "do anything necessary to preserve national security" and to detain people even on suspicion of "engaging in any act or thing or being in possession of anything which poses a threat to national security," the rights groups said.

The law also enables police to extend detention before trial for 360 days with court authorization, well beyond the 24-hour limit that Kenyan law currently allows and allow prosecutors to not disclose evidence to the accused if "the evidence is sensitive and not in the public interest to disclose."

Rights groups worry that the government is trying to silence them with the new law. The government announced Tuesday that it banned 510 non-governmental organizations for not filing their annual audited reports. Fifteen other non-governmental organizations were banned for allegedly financing terrorism.

Associated Press Producer Khaled Kazziha contributed to this report