The Tunisian parliament has adopted a new "anti-terror" law aimed at beefing up authorities' powers following recent deadly attacks claimed by the Islamic State of Iraq and the Levant (ISIL) group.

Following three days of debate, the law was adopted late on Friday night, with 172 members of parliament voting in favour and ten abstentions.

The new laws impose the death penalty as a possible sentence for a range of "terror" offences and will allow authorities to detain terror suspects for up to 15 days without access to a lawyer.

State of emergency declared in Tunisia

The president of the parliamentary assembly, Mohamed Ennaceur, called the passing of the law a "historic" moment and said it would "reassure" the nation's citizens.

The new legislation comes after a gunman massacred 38 tourists on a Tunisian beach in an attack in Sousse claimed by ISIL on June 26.

In March, an attack on the Bardo museum in the Tunis that was also claimed by ISIL left 21 tourists dead.

"Millions of Tunisians have been grappling with the recent violence and ... they say this is something that has to be addressed," Al Jazeera's Hashem Ahelbarra, reporting from the capital Tunis, said.

"The government says with the new bill it will be able to tackle the rise of violence, but it also says it needs financial and military support from the international community so it can defeat armed groups," our correspondent added.

The death penalty already exists under Tunisian law, for crimes such as murder and rape, but no one has been hanged since 1991.

Rights groups had hoped parliament would leave it out of the anti-terror bill.

Advocacy groups, including Amnesty International and Human Rights Watch, have condemned the bill.

Describing it as draconian, they said the bill's definition of terrorist crimes is too vague and that it fails to adequately safeguard the rights of defendants and could undermine freedoms.

Source: Al Jazeera and agencies