Turkey's former armed forces chief was expected to defend himself against terrorism charges on Tuesday at a trial unthinkable before Prime Minister Tayyip Erdogan took on the power of a military that had dominated Turkey for decades.

General Ilker Basbug, chief of staff in 2008-2010, exchanged salutes with former colleagues during a break in Monday's first day of a trial encroaching on sensitive territory in a country that saw three coups in the second half of the 20th century.

Other supporters demonstrated outside the court with Turkish flags and placards showing Basbug.

The court is sitting in the Silivri high-security prison complex where he and other accused conspirators are held.

Basbug is accused of being a leader of a shadowy network dubbed Ergenekon, behind a string of alleged plots against the government of Erdogan. Ergenekon is accused of planning campaigns of disinformation, bombings and assassinations to stir panic and precipitate an army coup.

Comments by Basbug's lawyer reflected a sense among some conservatives that the case itself presented a challenge to the constitutional order.

The allegation...is not only against Ilker Basbug, but also against the Turkish armed forces and even, in political terms, the state, lawyer Ilkay Sezer said on the eve of the trial.

The military has viewed Erdogan, a man with roots in political Islam, and his AK Party with deep suspicion since it was first elected in 2002.

Since then, AK Party has built up a huge majority in parliament, reformed the judiciary and used authority bolstered by economic success to strip the military of the power it has enjoyed virtually to make or break governments.

The case against Basbug features websites allegedly set up by the military to spread black propaganda against the government until 2008, including one titled Islamic fundamentalism.

The websites had exaggerated news headlines on the threat from fundamentalism in Turkey designed to provoke the people against the executive organ and create an atmosphere of chaos in the country, the indictment said.

GUARDIANS

During his pre-trial detention Basbug has shared a cell with two other generals in the top-security prison at Silivri, west of Istanbul, where an extra-large courtroom has been specially built to hear Ergenekon and Sledgehammer-related cases.

Police say they discovered Ergenekon when they seized a secret arms cache in 2007, yet many Turks still doubt it exists.

Basbug is a witness in the Sledgehammer case, which revolves around a 2003 seminar that prosecutors say contained blueprints for a coup. The military says it was just a war game.

Some 365 people are being tried in the case, including the retired commander of the prestigious First Army.

Turkey's generals traditionally saw themselves as guardians of the secular state envisaged by the republic's founder, soldier-statesman Mustafa Kemal Ataturk. It was long the most popular institution in Turkish public life and its utterances treated with a mixture of awe and respect.

Like the judiciary, the generals distrusted Erdogan and other members of the Justice and Development Party (AKP) with an Islamist past. Erdogan denies any ambitions to forge an Islamist state and insists he is committed to a secular political system.

The military staged three coups in 1960-1980 and forced an Islamist prime minister, Necmettin Erbakan, to quit in 1997.

(Writing by Simon Cameron-Moore)