The Egyptian parliament on Tuesday approved a new law regulating non-governmental organizations that gives security agencies extensive power over the financing and activities of NGOs and rights groups.

Rights organizations condemned the law as one of Egypt's most repressive ever on civil society, saying it would effectively shut down many such groups. Supporters of the bill called it a necessary regulation to protect the country's security, but critics said it was part of a widening crackdown on dissent under the government of President Abdel-Fattah el-Sissi.

Under the law, which must still be ratified by the president, those that violate administrative rules governing such groups could face up to five years in prison and heavy fines of up to 1 million Egyptian pounds (around $55,000). Under the rules, groups must get state permission to receive foreign funding or local donations of more than 10,000 pounds (about $550) or even relocate headquarters or carry out research and surveys.

The permissions will be provided solely by a newly created oversight body made up of several government agencies and security apparatuses such as the intelligence agency, and the ministries of defense and interior.

Rights groups advocating against police abuses and defending freedom of speech will find themselves having to seek authorizations from the very security apparatuses whose practices they routinely condemn.

"There will be a massacre for rights groups and NGOs," said Mohamed Zaree, manager of Egypt's oldest rights group, the Cairo Institute for Human Rights Studies.

Since the overthrow of Egypt's President Hosni Mubarak in mass uprising in 2011, Egypt's rights groups have faced a heavy security crackdown. State media have waged a concerted campaign accusing them of fueling instability and acting as a "fifth column" for Western countries to carry out foreign agendas.

Elected in 2014 after leading the military's ouster of Islamist President Mohammed Morsi, el-Sissi has carried out a wide crackdown on opposition, mainly on Islamists but also targeting secular critics.

Just a few months after the 2011 uprising, security forces raided 17 offices of mostly foreign NGOs and referred 43 people, including American citizens, to trial for violating laws governing the organizations. Most of the defendants fled the country and were sentenced in absentia.

This year, the authorities revived the same case and have targeted a string of leading rights activists, freezing their assets and banning them from travel while putting them under criminal investigations. If found guilty of illegally receiving foreign funds, or other charges linked to harming national security, they would face sentences that could reach life imprisonment.

Zaree said those investigations "will end the existing rights groups, and the law will lock the door for future ones to emerge."

The effects of the new law, if signed by el-Sissi, go beyond rights groups, putting heavy control over the estimated 50,000 NGOs covering everything from health and development issues to local community work and charities.

One provision in the law forbids the groups from practicing "activities that cause disruption of national unity, national security, public order, and public morals."

Rights groups have expressed concern such vague terms could be used to stop any activity the government does not approve of.

Another provision requires charities and NGOs providing social services to work in accordance with the state's agenda for national development.

"This is inspired by the 1960s laws, where civil society was nationalized and turned into another branch from the government," said Zaree.

London-based rights group Amnesty International described the law as a "death warrant" for rights groups and urged el-Sissi not to ratify it.

The United Nations said the new bill will turn local NGOs into "government puppets"

Maina Kiai, the U.N. special rapporteur on the rights to freedom of peaceful assembly and of association, said in a statement that the bill's provisions violate international law and contradict Egypt's own constitution.

"This bill proposes perhaps the worst restrictions on fundamental freedoms in Egypt since the 2011 uprisings," Kiai said. "It aims to destroy Egypt's foundation for peaceful, civic engagement at its very roots."

"Civil society can't perform this function when the law reduces it to the role of the government's spokesperson," he said.

The law overwhelmingly passed in the parliament, which is dominated by el-Sissi suporters.

Mohammed Abu-Hamed, a lawmaker and deputy head of the committee that drafted the law, defended it by saying the goal was to strike a balance between the needs of civil society and national security, which the existing law failed to achieve.

"The new law fills in the gap and protects the state from the dangers of harming national security," he said. Criminal penalties were needed to act as a deterrent, he added.

"What if an NGO receives money to use explosives?" he argued.

Lawmaker Haitham el-Hariri, who was among a handful of lawmakers who opposed the law, said that only a brief discussion took place amid a climate of "intimidation."

"Whoever opposed the law was automatically accused of working against the state's national security," he said, adding that pro-government lawmakers interrupted critics by saying the NGOs were receiving foreign funds to "destroy Egypt."

"The law is disastrous," el-Hariri said. "I told the head of the parliament: you are facing a historic responsibility and if you let this law pass, Egypt's reputation will be badly damaged."