Under pressure from a jihadist insurgency, Egypt's President Abdel Fattah al-Sisi approved an anti-terrorism law that sets up special courts and protects its enforcers.
The law has come under fire from human rights groups who accuse Sisi, who as military chief deposed a freely elected Islamist president in 2013, of rolling back freedoms won in the 2011 uprising that toppled veteran autocrat Hosni Mubarak.
Approved on Sunday, the law details sentences for various terrorism crimes ranging from five years to the death penalty.
It also shields those applying it, such as the military and police, from legal ramifications for what it calls the proportionate use of force "in performing their duties".
Sisi had promised a tougher legal system in July after a car bomb attack in Cairo that killed the chief public prosecutor, the highest ranking state official to be killed in years.
The law, as reported by state media, said special courts would "fast-track" terrorism cases but gave no further detail, such as whether trials would be open or closed to the public.
Forming or leading a group deemed a "terrorist entity" by the government will be punishable by death or life in prison under the new law, and membership in such a group will carry up to 10 years in jail.
Financing "terrorist groups" will bring a penalty of life in prison, which in Egypt is 25 years. Inciting violence, which includes "promoting ideas that call for violence", will lead to 5-7 years in jail, as would creating or using websites that spread such ideas.
Journalists will be fined for contradicting the authorities' version of any militant attack. The original draft of the law was amended following a domestic and international outcry after it initially stipulated imprisonment for such an offence.
Throwback to Mubarak era
"This is taking us back to the Mubarak era and the 30-year state of emergency that helped push Egyptians to the streets in 2011," Mohamed Elmessiry, Egypt researcher at Amnesty International, said in a statement.
"Despite security forces having a record of excessive use of force, this law...paves the way for impunity."
Elmessiry also said the law would in effect remove the current two-year limit on pre-trial detention by allowing prosecutors to ask to renew suspects' detention indefinitely.
"The law contravenes the Egyptian constitution and national laws, let alone international law," he said.
Egypt, the Arab world's biggest nation, is facing an increasingly violent insurgency in North Sinai, where the most active militant group has pledged allegiance to Islamic State.
Cairo and other cities have also witnessed militant attacks. The insurgency, which has killed hundreds of soldiers and police, has intensified since mid-2013 when then-army chief Sisi ousted President Mohamed Mursi, a top figure in the Muslim Brotherhood, after mass unrest against his rule. Sisi has since overseen a security crackdown on Islamists.
Thousands of alleged Islamist supporters have been jailed and scores have been sentenced to death, including Mursi and other senior Brotherhood figures.
The government considers the Brotherhood a terrorist group and does not distinguish between it and other militants. The Brotherhood says it is committed to peaceful activism.
In February, Sisi signed off on another anti-terrorism law that gave authorities sweeping powers to ban groups on charges ranging from harming national unity to disrupting public order.
Sisi essentially rules by decree as Egypt's parliament has been suspended since 2012 when a court dissolved the democratically elected main chamber, undoing a major accomplishment of the 2011 revolt.