Turkish authorities have detained a prominent philanthropist, just hours after a court acquitted him on terrorism-related charges and ordered his release from jail.

Osman Kavala was one of nine activists accused of terror charges over their involvement in Istanbul’s Gezi park protests who were acquitted on Tuesday in a surprise ruling.

But within hours, a new warrant from the Istanbul prosecutor’s office called for his re-arrest as part of an investigation into a failed 2016 coup against Recep Tayyip Erdoğan’s government, and under the charge of attempting to overthrow the constitutional order.

After his release from the the Silivri maximum security prison on the outskirts of Istanbul, Kavala was taken by police to an Istanbul hospital for health checks before being formally detained again.

The court’s earlier ruling was greeted by applause and cries of disbelief in the courtroom where more than a hundred supporters had waited to see Kavala walk free.

But an anxious silence overtook the stunned crowd – including Kavala’s wife Ayşe Buğra – when word of the new investigation reached them later on Tuesday.

Kavala had been held in pre-trial detention for more than two years, and a guilty verdict had been widely expected for him, the architect Mücella Yapıcı and Yiğit Aksakoğlu, who were also facing life sentences in solitary confinement without parole.

After hearing about the new detention order for Kavala, Yapıcı tweeted: “Once again, a freakishness of the law, first you linked him to Gezi in an unrelated and illegal way and now July 15 … Pity this country.”

Six more of the 16 civil society figures on trial – among them an architect, a lawyer and filmmakers – were facing 15 to 20 years in prison each over allegations that they sought to violently overthrow then prime minister and now president Recep Tayyip Erdoğan.

The case of seven further defendants, who are abroad and are being tried in absentia, will continue, but arrest warrants against them have been lifted. One lawyer said they were expected to be acquitted if they returned to Turkey.

Kavala’s re-arrest sparked immediate condemnation from human rights advocates.

“This is a vindictive and lawless move, further demonstrating that Turkey’s justice system is under tight political control,” Emma Sinclair-Webb, of Human Rights Watch, told AFP.

Amnesty International slammed the “cynical and outrageous detention” and called for Kavala’s immediate release.

“This decision smacks of deliberate and calculated cruelty,” Amnesty’s Turkey campaigner Milena Buyum said.

“It is time for Turkey to end the relentless crackdown on dissenting voices.”

The high-profile case had already drawn strong criticism from Turkey’s western allies and human rights groups, including the European court of human rights, which in December called for Kavala’s immediate release, saying his extended time in custody served the ulterior purpose of reducing him to silence with a chilling effect on civil society.

“This is a trial that should have never happened in the first place. This whole process has caused untold misery to those who were so wrongfully targeted,” said Sinclair-Webb, outside the courthouse.

More than 300 observers came to watch the tense proceedings on Tuesday, where the court rejected requests to hear the testimony of defence witnesses and to give the defendants more time to respond to the prosecutor’s sentencing statement.

Tensions peaked when security forces tried to remove a defence lawyer from the courtroom. Officers in riot gear arrived after members of the audience and lawyers loudly voiced their objections.

Questions had already started to arise over why the court would rule against the government in such a high-profile case .

Speculation was rife on Tuesday that the move was calibrated to gain favour in Brussels and other western capitals as Ankara struggles with a new military campaign against Bashar al-Assad in Idlib, Syria’s last opposition-held province.

The Gezi trial has been closely watched by western diplomats and human rights groups for years for clues over Turkey’s democratic trajectory. The minister of defence, Hulusi Akar, pointedly acknowledged Nato’s support for the Turkish armed forces in Syria in a statement last week.

The 2013 demonstrations were held over the future of Gezi park, a rare green space in central Istanbul, which was slated for redevelopment into a shopping mall.

The discontent soon blossomed into nationwide protests against Erdoğan’s increasingly strong grip on Turkey, in which an estimated 3.6 million people took part. The demonstrations were met with a police crackdown in which the Turkish Bar Association says 15 people were killed and about 5,000 more were arrested.

The fallout from Gezi reignited political tensions between Turkey’s right and left and set the scene for the increasingly authoritarian direction the government has travelled in since.