Turkey's parliament on Tuesday passed a law to allow tens of thousands of prisoners to be released to curb the spread of the coronavirus in the country's overcrowded prisons, but the exclusion of those jailed on "terrorism" charges in the crackdown following the 2016 coup drew criticism.

President Recep Tayyip Erdogan's AK Party and nationalist MHP allies supported the bill, which was passed with 279 votes for and 51 votes against, deputy parliament speaker Sureyya Sadi Bilgic said.

More:

The law will open the way for the temporary release of about 45,000 prisoners to curb the spread of the coronavirus. Those eligible will be released under judicial control until the end of May and the Justice Ministry will be able to extend the period twice by a maximum of two months each time, according to the law.

A similar number would be released permanently under a separate part of the legislation aimed at reducing overcrowding in prisons.

Journalists, politicians jailed

Justice Minister Abdulhamit Gul said on Monday there were 17 confirmed cases of COVID-19 among prisoners, including three deaths. He said 79 prison personnel had also tested positive, along with a total of 80 judges and prosecutors, as well as staff from the judiciary and forensic science officers.

The law has been criticised by opposition parties for excluding those jailed on "terrorism" charges, which include journalists and politicians swept up in a crackdown following a coup attempt in 2016.

In the ensuing crackdown, the number of prisoners has risen to nearly 300,000 - the second-largest prison population in Europe and the continent's most overcrowded prison system as of January 2019, according to data from the Council of Europe.

About 50,000 people convicted or jailed pending trial on "terrorism" charges are excluded, according to an opposition parliamentarian.

Turan Aydogan, from the main opposition Republican People's Party (CHP), said the law should have been designed to protect freedom of thought.

"You lock up whoever criticises. We tried to find a solution here but you are neutral," he said, addressing AK Party and MHP members in parliament.

The independence of Turkey's judiciary has been hotly debated in recent years with critics saying court rulings are influenced by politicians.

Erdogan and his AK Party say the judiciary makes its decisions independently.