ANKARA  - Lawmakers in Turkey on Friday abolished the special courts which convicted hundreds of alleged military coup plotters, as Prime Minister Tayyip Erdogan battles a new foe he sees as using influence in the judiciary to try to unseat him.

Erdogan's Islamist-rooted AK Party is widely held to have relied heavily on US-based Islamic cleric Fethullah Gulen's influence in the police and judiciary in breaking the power of the army, which carried out three coups between 1960 and 1980 and forced an Islamist-led government from power in 1997.

Now Erdogan is battling a corruption scandal he sees as contrived by Gulen's Hizmet (Service) movement, and has already dismissed or reassigned thousands of police and hundreds of judges and prosecutors in a bid to purge its influence.

The scandal poses one of the greatest threats of Erdogan's 11-year rule and his response has betrayed what critics say are his increasingly authoritarian tendencies. Gulen's supporters have said they are the victims of a witch-hunt.

Parliament passed a law in the early hours, proposed by the AK Party, abolishing the special courts which convicted hundreds of army officers and others in the high-profile "Sledgehammer" trial on charges of plotting to overthrow the government.

The law could mean the officers being retried in regular criminal courts, a possibility Erdogan mooted last month. It may also lead to a review of cases involving military, businessmen, journalists and politicians jailed in a separate "Ergenekon" conspiracy investigation.

"The prime minister has on a number of occasions expressed his dissatisfaction and his concern about some of the Ergenekon trials," a senior Turkish official said this month.

"Some of these judges feel so empowered within the system, and now it is the same judges that are trying to bring down this government ... When they turn against you, you have to fight back," he said.

Battling the graft scandal, Erdogan's AK Party has pushed through laws tightening control over the Internet and the courts this month, and has proposed a bill envisaging broader powers for the national intelligence agency. Erdogan's critics regard these steps as an authoritarian backlash against the corruption inquiry. The government says the laws defend democracy in the face of a bid by Gulen to wield covert influence over the state, a charge the cleric denies.

Parliament had already moved to abolish the "special authority" courts in 2012 but that legislation allowed for them to continue hearing existing cases. Under the new law, they will be definitively closed.

The army, which has in the past hinted at concerns over the role of the Hizmet movement, has filed a criminal complaint over the coup plot trials, arguing evidence against serving and retired officers had been fabricated.

Under the new legislation, the maximum detention period will also be reduced to 5 years from 7-1/2 years.