As Turkey declares a three-month state of emergency following a failed coup, Canadian Prime Minister Justin Trudeau says his government has urged the country to respect the rule of law.

Trudeau said Wednesday that he has raised his concerns with the Turkish government after the arrests of thousands of soldiers and police officers following the failed coup against President Recep Tayyip Erdogan's government.

Trudeau says those who have been arrested should be able to defend themselves in a robust and legitimate process in Turkey.

Erdogan, meanwhile, has declared a three-month state of emergency. The president declared 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.

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

TURKEY-SECURITY/

Turkish President Tayyip Erdogan has declared a three-month state of emergency after a failed coup in the country. (Umit Bektas/Reuters)

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.

21,000 teachers fired

Turkish media says the government is expanding its purge of suspected coup backers and has begun to revoke the licenses of 21,000 teachers at private schools.

The state-run Anadolu news agency reported the teachers are believed to have ties to U.S.-based cleric Fethullah Gulen, whom the government has accused of being behind the failed military coup last week. Gulen has strongly denied the accusations.

Canadian Foreign Minister Stéphane Dion said Canada has received requests from Turkey before and after the coup about supporters of Gulen who were living in Canada.

"We have asked for evidence because ... the Canadian justice system cannot press an issue on the basis of allegations," Dion said.

Dutch, German and Canadian foreign ministers on Wednesday expressed concern about the scale of the crackdown called on Turkey to respect the rule of law.

TURKEY-SECURITY/

A supporter holds a flag depicting Turkish President Tayyip Erdogan during a pro-government demonstration in Ankara, Turkey, on July 20. (Baz Ratner/Reuters)

Another 262 military court judges and prosecutors have been fired in Turkey, as well. The number of people fired from Turkish institutions is now approaching 70,000 since the coup, and more than 10,000 have been arrested.

Turkey has already announced the firing of 15,200 teachers at state institutions, demanded the resignations of 1,577 university deans and halted all foreign assignments for state-employed academics. In addition, thousands of other state employees have been fired in half a dozen agencies, all accused of being Gulen followers.

Rights group Amnesty International says the crackdown has extended to censoring media and journalists, including those critical of the government.

It says authorities have blocked access to more than 20 news websites, cancelled press cards for 34 journalists, and issued an arrest warrant for one journalist for her coverage of the coup.

The London-based organization also says there are local reports that the licenses of 25 media houses were revoked.

Amnesty called on authorities to protect press freedoms while they investigate the failed coup.

And a hotel in Istanbul's Eyup district municipality is being demolished — it was allegedly the meeting point of the plotters who planned the coup. The directive to demolish the Halit Pasa Residence was issued on July 18, three days after the failed coup, and approved by the mayor.

Turkish soldiers seek asylum in Greece

Authorities in northern Greece say eight Turkish military officers seeking asylum here after Turkey's failed coup attempt have been moved to a different police detention site for security reasons.

The officers flew to neighbouring Greece in a military helicopter in the wake of Friday's deadly coup attempt, triggering demands for their return from Ankara.

On Wednesday, the eight were moved from a police station near the border town of Alexandroupolis to the northern city of Kavala, 190 kilometres further inland. Members of Greece's small Turkish-speaking minority jeered at the officers when they appeared in court this week in Alexandroupolis and police intervened to hold the crowd back.

They are due appear in court again Thursday. The helicopter has already been returned to Turkey.

WikiLeaks blocked

The government has also blocked access to the WikiLeaks website after the group announced it would release a trove of documents related to the country's power structure following the coup attempt.

There was no immediate statement Wednesday from Turkey's Telecommunications Board, a government agency that regulates access to websites.

The Turkish government has previously banned access to websites deemed to be carrying material critical of Turkey, including YouTube and Twitter. Some opposition media websites were blocked following Friday night's coup attempt, which was quashed by security forces loyal to President Recep Tayyip Erdogan.

WikiLeaks said on Twitter that Turks who are blocked from accessing its website can "use a proxy or any of our IPs" to get access to the documents on Turkey's ruling party.