A Turkish court has sentenced former armed forces chief Ilker Basbug to life imprisonment for allegedly conspiring to overthrow the government.

Announcing verdicts on the nearly 300 defendants in the case on Monday, the judges also sentenced three serving parliamentarians from the opposition Republican People's Party (CHP) to between 12 and 35 years in prison.

The court also acquitted 21 defendants in the case that has exposed deep divisions in the country.

Earlier, security forces fired tear gas in fields around the courthouse in the Silivri jail complex, west of Istanbul, as defendants' supporters gathered to protest against the five-year trial that has become a battle between Prime Minister Recep Tayyip Erdogan and the secularist establishment.

Prosecutors say an alleged network of secular arch-nationalists pursued extrajudicial killings and bombings in order to trigger a military coup and overthrow the ruling Justice and Development Party (AKP) government.

There are 275 defendants, including retired armed forces commander Basbug, high profile military generals, journalists and professors. All have been accused of being members of a little known underground group called Ergenekon.

Courthouse secured

Ahead of the verdict, state authorities banned protests at the court, and police on Saturday raided offices of a secularist association, political party and television channel, detaining 20 people for calling for demonstrations.

Security forces set up barricades around the courthouse in the Silivri jail complex to tighten security after the defendants' supporters vowed to hold a demonstration against the trial.

Reporting from Silivri, Al Jazeera's Aylin Yazan said the police blocked the road heading to the complex and protesters were waiting about 10km from the courthouse.

"It is not very crowded yet as the governor of Istanbul has said no protesters would be allowed in front of the courthouse," she said.

Critics, including the main opposition party, have said the charges are trumped up, aimed at stifling opposition and taming the secularist establishment which has long dominated Turkey.

They say the judiciary has been subject to political influence in hearing the case.

The Ergenekon investigation started in June 2007 after an anonymous tip led police to find explosives in a shanty house belonging to a retired officer.

Critics claim the investigation has only focused on the opponents of the AKP government.

The government denies any such motives, and insists that it aims at the elimination of a so-called "deep-state", a force alleged to be operating within the state.

In September 2012, the court in Silivri sentenced more than 300 military officers to jail on charges of plotting to overthrow Turkish Prime Minister Recep Tayyip Erdogan in 2003.