Ilker Basbug was arrested in 2012 and accused along with 275 army officers, journalists and academics of membership in Ergenekon, a right-wing underground organization that allegedly plotted to stage a military coup. His term as military chief ended in 2010.
The court in Silivri, 90 kilometers west of Istanbul, acquitted 21 defendants. Other defendants received sentences ranging from six to nearly 50 years, the Hurriyet Daily News reported on its website.
Retired colonel Arif Dogan was sentenced to 47 years, former North Sea field commander Mehmet Otuzbiroglu was sentenced to 20 years and journalist Erol Manisali was sentenced to nine years.
Police used tear gas to disperse crowds gathered in fields near the court before judges began reading out the verdicts.
Highways leading to the court were closed as part of security measures to block possible demonstrations. A military helicopter flew above.
The verdicts come after weeks of protests that began in late April against Erdogan's rule.
Turkey's powerful military, which sees itself as the ultimate guardian of the state and secularism, has staged three military coups since 1960 and a "soft coup" in 1997. Elements of the military are known to be opposed to Erdogan's Justice and Democracy party (AKP).
The opposition Republican People's Party (CHP) accused the government of fabricating the Ergenekon case to settle scores with its secular opponents.
Ergenekon is the name that prosecutors said members of the underground group called themselves and refers to the mythical Turkic homeland in Central Asia.
Prosecutors said the group also had plans to carry out assassinations of political and social leaders, including Erdogan, former chief of the general staff Yasar Buyukanit and Nobel Prize-winning author Orhan Pamuk.
NJF/NJF