Erdogan made ending the unpopular emergency rule a campaign promise in a June election, which he handily won. The protracted emergency rule has dragged down Turkey’s economy, scared off investors and unleashed international condemnation. Earlier this year, the UN accused Turkey of “profound human rights violations ” including torture, arbitrary arrests and curtailment of civil liberties.

Emergency rule allowed Erdogan to bypass parliament and largely rule by decree — a power that has now been enshrined for his office following changes to the constitution that he designed and won approval for in a referendum last year.

President Recep Tayyip Erdogan imposed emergency rule in the days following an abortive military coup on July 15, 2016, when rogue soldiers commandeered fighter jets to bomb parliament and used tanks to trample his supporters, killing some 250 people.

The government has promised to realign its security laws to meet universal standards, but the European Union warned the legal changes it is proposing remain far too restrictive. Opposition parties dismissed the legislative package as a ruse to create a permanent state of emergency.

A two-year state of emergency in Turkey during which hundreds of thousands of people have been jailed or lost their jobs officially expired on Thursday, bringing an end to a regime that rights groups and the United Nations said was rife with abuse.

On Thursday, the government allowed emergency rule to lapse at 1:00 a.m. local time rather than renew it for another three months as it had seven times previously.

Instead, the ruling Justice and Development Party (AKP) submitted to parliament this week a package of legal changes that retains for three more years some measures used during the clampdown, including the power to purge members of the civil and security services. More than 150,000 of people have been sacked from their jobs since the coup attempt.

State-appointed governors can restrict access to parts of their provinces for security reasons, and terrorism suspects can be detained without charge for up to 12 days. Nearly 80,000 people have been imprisoned since the coup attempt.

“The end of emergency rule does not mean our struggle against terrorism ends,” Justice Minister Abdulhamit Gul said this week. “All terrorist groups that seek to strangle Turkey will be fought with persistence and determination until the end, especially FETO.”

FETO is the government’s abbreviation for followers of the Islamic cleric Fethullah Gullen, whom it says masterminded the failed coup. Gulen, who lives in Pennsylvania, denies involvement.

The AKP said its new security proposals meet EU standards. “We prepared a bill that includes measures envisaged by international institutions as universal law, especially Europe,” said Bulent Turan, the AKP’s group deputy chairman.

The EU, which all but froze Turkey’s accession process during the state of emergency, welcomed its end but warned that the planned security measures mean that basic democratic values are not being restored.

“We believe the adoption of new legislative proposals granting extraordinary powers to the authorities and retaining several restrictive elements of the state of emergency would dampen any positive effect of its termination,” said Maja Kocijancic, spokeswoman for the EU’s foreign affairs office. The EU expects Turkey to reverse measures that harm the rule of law, the separation of powers and basic freedoms, she said in a statement.

Opposition parties said the new security proposals infringe upon both Turkey’s constitution and the European Convention on Human Rights by codifying the spirit of emergency rule into Turkey’s legal system.

“We face an attempt to give legal status to open-ended regulations that are more restrictive than martial law,” Ayhan Bilgen, a deputy from the Peoples’ Democratic Party, parliament’s third-largest group, said at a news conference.

More than 4,500 people accused of having a direct role in the coup have either been convicted or remain on trial, according to the Justice Ministry. Bilgen said the government has failed to redress the grievances of the thousands of others who have been penalized in the last two years.

Allowing the state of emergency to lapse will not “lift the suffocating climate of fear that has engulfed the country,” said Fotis Filippou, Amnesty International’s deputy Europe director, adding, “Over the last two years, Turkey has been radically transformed with emergency measures used to consolidate draconian powers, silence critical voices and strip away basic rights. Many will remain in force following the lifting of the state of emergency.”

Among those voices that have been muzzled are Amnesty’s honorary Turkey chairman, Taner Kilic, who has been in prison for more than a year on coup-related charges. Hundreds of journalists, civil society activists and opposition politicians — many of them not charged with coup-related offences — also remain behind bars.

Even as the state of emergency lapsed, a court sentenced a journalist to more than two years in prison Thursday for targeting counter-terrorism officials in her reporting.