A Turkish court has freed four academics from jail on the first day of their trial for spreading “terrorist propaganda”, as prosecutors moved to scale back the charges against them.

The four, on trial for signing a petition denouncing the government’s military operations against Kurdish rebels, were released “pending permission from the justice ministry” to change the charge, lawyer Benan Molu told Agence France-Presse.

Under the original charge, Esra Mungan, Meral Camcı, Kivanç Ersoy and Muzaffer Kaya faced up to seven and a half years behind bars.

But prosecutors want to bring charges against them under under article 301 of the Turkish Penal Code that states that “denigrating Turkishness” is a criminal act. The offence carries a maximum sentence of two years in jail.

Supporters in court applauded as the four walked free, with the judge setting setting the next hearing for 27 September.

Earlier, Kaya had fiercely defended the petition, telling the court that the state had “not managed to stifle the voices of our conscience” and that he and the three other academics had been arrested for criticising political power, Dogan news agency said.

“You may find our petition ridiculous, but you can never say we were spreading terrorist propaganda. Acquit me,” he said.

Riot police had stood guard outside the courthouse in central Istanbul, where the academics’ trial had followed a morning hearing in the case of two journalists accused of divulging state secrets.

|About 500 people had gathered at the court to support the journalists and the scholars, with protesters holding up placards reading “Freedom for the academics” and “Freedom for the pencils”.

Supporters of the four jailed Turkish academics celebrate outside the Istanbul courthouse. Photograph: Ozan Kose/AFP/Getty

The petition had urged Ankara to halt “its deliberate massacres and deportation of Kurdish and other peoples in the region”, infuriating the Turkish president, Recep Tayyip Erdoğan, who accused the academics of falling into a “pit of treachery”.

The four stood accused of engaging in “terrorist propaganda” and “inciting hatred and enmity” for signing the plea and making a statement on the same lines on 10 March, a day before the petition was published.

They had been held in high-security closed prisons in Istanbul since their arrest last month.

As well as signatories from more than 90 Turkish universities, the petition was also endorsed by dozens of foreigners, among them the US linguist Noam Chomsky and the Slovenian philosopher Slavoj Žižek.

Turkey is waging an all-out offensive against the separatist Kurdistan Workers’ party (PKK), with military operations backed by curfews aimed at flushing out rebels from several urban centres in the south-east of the country.

But Kurdish activists say dozens of civilians have died as a result of excessive force.

The decision to haul scholars and journalists into court has deepened unease over freedom of expression under the increasingly autocratic Erdoğan.

The US and EU have expressed concern over the trial of the newspaper Cumhuriyet’s editor, Can Dündar, and his Ankara bureau chief Erdem Gül, who both face life behind bars over a story accusing the government of seeking to illicitly deliver arms to Islamists in Syria.

The hearing was dedicated to the prosecution’s request to merge the journalists’ trial with another, in which former politicians and intelligence officials are accused of trying to overthrow the government. The court denied the request.

“Their plan was smashed to bits. We are journalists and have nothing to do with that case, the court confirmed that. I think we made a step towards acquittal,” Dündar said as the hearing ended. The next hearing was set for 6 May.

In the 2016 World Press Freedom Index, Turkey slipped two places to 151 out of 180, Reporters Without Borders said this week, citing Erdoğan’s “offensive” against the media and his critics.

Almost 2,000 people have been prosecuted for “insulting” Erdoğan since the former prime minister became president in August 2014, Turkey’s justice minister said in March.