ANKARA, Turkey — Turkey will be able to extend detention times for suspects and issue decrees without parliamentary approval under a three-month state of emergency approved Thursday by lawmakers following last week’s attempted military coup.

Parliament voted 346-115 to approve the national state of emergency, which gives sweeping new powers to President Recep Tayyip Erdogan, who had been accused of autocratic conduct even before this week’s crackdown on alleged opponents. Erdogan has said the state of emergency will counter threats to Turkish democracy.

Even without the emergency measures, his government has already imposed a crackdown that has included mass arrests, mass firings and the closure of hundreds of schools. Erdogan said the new powers would allow the government to rid the military of the “virus” of subversion, blaming the coup attempt on a U.S.-based Muslim cleric, Fethullah Gulen. who has denied any link to the attempted coup.

“This is a state of emergency imposed not on the people, but on (the state) itself,” declared Prime Minister Binali Yildirim. “We will, one by one, cleanse the state of (Gulen’s followers) and eliminate those who are trying to harm the country.”

The government hopes the state of emergency will be lifted within 40 to 45 days, said Yildirim’s deputy, Numan Kurtulmus.

Turkey immediately said it was partially suspending the European Convention on Human Rights, allowing it more leeway to deal with individual cases, by invoking an article most recently used by France and Ukraine.

Since the July 15 coup attempt, the government has arrested nearly 10,000 people. Over 58,880 civil service employees – including teachers, university deans and police – have been dismissed, suspended, forced to resign or had their licenses revoked for allegedly being Gulen followers.