A former head of Turkey's armed forces is to go on trial after judges agreed on Wednesday there were sufficient grounds to prosecute him on charges of attempting to overthrow the government.

The case of General Ilker Basbug, military chief of staff from 2008 to 2010, is one of a series of prosecutions and judicial inquiries that have engulfed the former secular establishment, but have now also touched on figures close to the government, suggesting a power struggle within the state.

Basbug, held in a high-security prison, is the most senior officer among hundreds of secularists charged with conspiring to topple Prime Minister Tayyip Erdogan's government because of its roots in political Islam.

Basbug will be tried on charges of attempting to overthrow the government of the Republic of Turkey and obstructing it in its duties and forming and directing an armed terrorist group for this purpose.

The case against Basbug is focused on anti-government propaganda published on websites that the military was accused of running until 2008. The websites have been linked to an alleged ultra-nationalist network called Ergenekon.

Opposition leaders have accused Erdogan of filling the courts with sympathetic judges who have set about dismantling the secularist establishment that dominated Turkey before his AK Party came to power in 2002.

But prosecutors have also turned against figures close to Erdogan, summoning Hakan Fidan, the head of the National Intelligence Agency (MIT), last week to testify on secret talks he held with the militant Kurdistan Workers' Party (PKK).

Fidan, who was appointed by Erdogan, ignored the summons and the prosecutor who issued it was removed from the investigation. The government then hastily drafted a bill to limit judicial powers to investigate top intelligence agents.

Some analysts have interpreted the move against Fidan, and the leaking of tapes of talks he held with PKK leaders in Oslo last year, as a warning by nationalist elements within Erdogan's party not to negotiate an end to the 27-year-old conflict, which has cost more than 40,000 lives.

(Writing by Jon Hemming; Editing by Kevin Liffey)