A Turkish courtinfo-icon on Wednesday found 42 former soldiers guilty of trying to kill President Tayyip Erdogan during last year's failed coup, and handed most of them life sentences in the highest profile case related to the attempted putsch so far.

Judge Emirsah Bastog read out guilty verdicts for 42 of the 47 defendants at the court in Mugla, southwestern Turkeyinfo-icon. Mugla is near the luxury resort where Erdogan and his family narrowly escaped a team of rogue soldiers who stormed his hotel during the night of the coup.

The trial, which started in February and included Erdogan as a co-plaintiff, is part of a sweeping security crackdown that followed the failed putsch of July last year. It is the biggest such case to reach a conclusion so far.

"I hope the verdict today is beneficial to everyone," Bastog said as he sentenced 34 of the accused to "aggravated" life sentences, the harshest punishment possible under Turkish law because it lengthens the minimum sentence required for parole.

Another six defendants were given life terms while two others were given lesser sentences.

"(Several) defendants have been found guilty on the charge of attempting to assassinate the president," Bastog told the packed courtroom.

One was acquitted and another was transferred to another court. No verdict was given for three who were tried in absentia, including USinfo-icon-based cleric Fethullah Gulen, whom Ankara blames for orchestrating the coup.

Demonstrators threw eggs and plastic bottles at the defendants as police escorted them from the courthouse. Others waved Turkish flags, blared a famous song praising the president and called for a return to capital punishment.

The court heard final statements from the defendants just before Bastog delivered his verdict. Some of the accused said they did not believe the court could deliver a fair verdict and had been under political pressure.

"From the moment I was arrested at the air base on July 16, I was treated like a criminal," Ergun Sahin, a former air force lieutenant, told the court.

PELTED WITH EGGS: Pictures released in the aftermath of the coup showed some suspected coup plotters -- including high-ranking military officers -- stripped to their underpants, handcuffed and their faces bruised.

"Words don't mean anything here as we didn't have a chance of a fair trial," said another defendant, Gokhan Sen. "We are just the grass that elephants trampled on during their fight."

More than 240 people were killed on the night of July 15, 2016, when putschists commandeered tanks, warplanes and helicopters, attacking parliament and attempting to overthrow the government.

Erdogan's lawyer, who was present at the case, said that justice had been served.

"Had these putschists succeeded that night in the attack against our president, historyinfo-icon would have changed, we would be living in a different Turkey now," Huseyin Aydin said.

"My son has been avenged," said Nihat Eker, the father of a police officer who was killed during the coup. "If our president were to present us with a choice, we'd all agree to it. We say, 'execution, execution, execution'."

Erdogan has previously said he would be willing to restore the death penalty if parliament passed such a measure. Turkey abandoned capital punishment more than a decade ago as part of its bid to join the European Unioninfo-icon.

Restoring it would all but end its attempt to join the EU.

While Turkey has seen a groundswell in nationalism since the coup, the extent of the government's crackdown has alarmed European allies and rights groups. More than 150,000 people have been sacked or suspended from their jobs and some 50,000 jailed.

Investors also worry about Erdogan's tightening grip on power and an erosion in the rule of law.

The government blames the network of Gulen, a former ally of Erdogan, for orchestrating the failed coup. Gulen, who has lived in self-imposed exile in Pennsylvania since 1999, has denied involvement and condemned the coup.

A total of 47 defendants were on trial, 43 of whom have been held in detention during the month hearing. Gulen was being tried in absentia. Most of the defendants were soldiers.