TURKEY’S president has declared a three-month state of emergency following a botched coup attempt, declaring he would rid the military of the “virus” of subversion and giving the government sweeping powers to expand a crackdown that has already included mass arrests and the closure of hundreds of schools.

President Recep Tayyip Erdogan, who was accused of autocratic conduct before the insurrection, said the measure would counter threats to Turkish democracy. Possibly anticipating investor jitters, Erdogan criticised Standard & Poor’s for downgrading its credit rating for Turkey deeper into “junk” status and said the country would remain financially disciplined.

The news comes as global alarm is mounting over the retaliatory action of the authorities since Friday’s attempted putsch, which has seen a massive crackdown in the military, police and judiciary and thousands detained.

Prime Minister Binali Yildirim said Turkey had sent dossiers to the United States to back up its demand for the extradition of Islamic preacher Fethullah Gulen, President Erdogan’s sworn enemy who lives in exile in Pennsylvania.

The President did not announce details, but the security measure could facilitate longer detentions for many of the nearly 10,000 people who have been rounded up since loyalist security forces and protesters quashed the rebellion that started Friday night and was over by Saturday.

“This measure is in no way against democracy, the law and freedoms,” Erdogan said in a national televised address after a meeting with Cabinet ministers and security advisers.

The state of emergency announcement needs to be published in a state gazette and lawmakers have to approve it for it to take effect, according to analysts.

Turkey imposed emergency rule in the southeast of Turkey in 1987, allowing officials to set curfews, issue search and arrest warrants and restrict gatherings as the security forces fought Kurdish rebels. The emergency rule was gradually lifted by 2002. The president suggested military purges would continue.

“As the commander in chief, I will also attend to it so that all the viruses within the armed forces will be cleansed,” Erdogan said.

In an apparent attempt to calm fears that the military’s powers will be increased, the president said the military will be under the government-appointed governors’ command and work closely with the regional governors.

The pro-government death toll in the botched coup was 246. At least 24 coup plotters were also killed.

Turkey also said it would close more than 600 private schools and dormitories following the attempted coup, spurring fears that the state’s move against perceived enemies is undermining key institutions in the country.

Erdogan’s government said it has fired nearly 22,000 education ministry workers, mostly teachers, taken steps to revoke the licenses of 21,000 other teachers at private schools and sacked or detained half a dozen university presidents in a campaign to root out alleged supporters of a U.S.-based Muslim cleric blamed for the failed insurrection.

The targeting of education ties in with Erdogan’s belief that the cleric, Fethullah Gulen, whose followers run a network of schools worldwide, seeks to infiltrate the Turkish education system and other institutions in order to bend the country to his will. The cleric’s movement, which espouses moderation and multi-faith harmony, says it is a scapegoat.

While Erdogan is seeking to consolidate the power of his elected government after the rebellion, his crackdown could further polarize a country that once enjoyed a reputation for relative stability in the turbulent Middle East region. It also raises questions about the effectiveness of the military, courts and other institutions being purged.

“The fact that so many judges have been detained, never mind the workload at the courthouses, will render them inoperable,” said Vildan Yirmibesoglu, a human rights lawyer.

The education ministry said it decided to close 626 private schools and other establishments under investigation for “crimes against the constitutional order and the running of that order,” the state-run Anadolu news agency reported.

The agency said the schools are linked to Gulen, a former ally of Erdogan who lives in Pennsylvania and has denied accusations that he engineered the coup attempt.

Turkey has demanded Gulen’s extradition from the United States. U.S. Secretary of State John Kerry says Turkey must provide hard evidence that Gulen was behind the foiled coup, and that mere allegations of wrongdoing wouldn’t suffice.

The two allies cooperate in the U.S.-led war against the Islamic State group, with American military planes flying missions from Turkey’s Incirlik air base into neighboring Iraq and Syria.

Turkey’s domestic situation is increasingly a concern as the crackdown widens. Huseyin Ozev, an education union leader in Istanbul, said state education workers who were reported to have been fired had not received notices and that employees were “waiting at home or on vacation, anxiously,” to see if they had lost their jobs.

The fight against coup plotters “should not be turned into a witch hunt,” Ozev said.

In other moves, Turkey demanded the resignations of 1,577 university deans and halted foreign assignments for state-employed academics. A total of 50,000 civil service employees have been fired in the purges, which have reached Turkey’s national intelligence service and the prime minister’s office.

The government has also revoked the press credentials of 34 journalists because of alleged ties to Gulen’s movement, Turkish media reported.

Authorities have rounded up about 9,000 people - including 115 generals, 350 officers, 4,800 other military personnel and 60 military high school students - for alleged involvement in the coup attempt. Turkey’s defense ministry has also sacked at least 262 military court judges and prosecutors, according to Turkish media reports.

Saban Ceylan, a taxi driver in Istanbul, said he expected his income to drop because of the state of emergency.

“Nothing is going to happen if I don’t take money home during three months,” Ceylan said. In a reference to the coup plotters, he said: “I just want this country to be rescued from those dishonorable people.”

Turkey has blocked access to WikiLeaks hours after the website leaked thousands of ruling party emails in aftermath of a failed military coup.