A Turkish court has sentenced three former generals to 20 years in prison on Friday for plotting a coup against the government, and convicted 330 of the 365 suspects in the so-called "Sledgehammer Coup" trial.

The officers, all of who denied the charges against them, were accused of planning bomb attacks against mosques in Turkey to trigger conflict with neighbouring Greece in order to destabilise the country and justify a military coup against the Islamic AKP government.

The Turkish military has traditionally played a dominant role in Turkish politics and staged coups in 1960, 1971, 1980 and 1997.

The government's relationship with the military, which regards itself as the guardian of the secular Turkish republic, has been strained since the AKP came to power in 2002.

Since then the military has been successfully kept in check by the government of Prime Minister Recep Tayyip Erdogan.

Former generals Çetin Dogan, Özden Örnek and Ibrahim Firtina were initially given life sentences, which were later decreased to 20 years. Six other generals and one former member of parliament from the nationalist party MHP were sentenced to 18 years in prison each.

Prosecutors had demanded 15 to 20-year jail sentences for the 365 defendants, all but one of whom are serving or retired military officers. Thirty-four of the 365 suspects were acquitted.

The former commander of Turkey's First Army, Çetin Dogan, who is said to be behind the coup, called the trial "unfair and unlawful". According to the transcript of his defence, he said: "Here we see a process unfolding to make the soldiers of Mustafa Kemal [Ataturk, the founder of modern Turkey], who give their lives for their country, pay the price of their commitment to the republic and its principles." Erdogan said: "We still have to wait for the decision of the supreme court of appeals. We have to see the grounds for the verdict first."

In a statement, lawyer Hüseyin Ersöz called the trial a "massacre of law" and said that the chance of a fair defence had been denied to the defendants.