ISTANBUL — An Istanbul court on Wednesday ordered the release of a group of leading Turkish human rights campaigners and two foreign co-workers — a German and a Swede — in a surprise softening in Turkey’s yearlong prosecutions after a 2016 coup attempt.

The decision, which came just before midnight, was an interim ruling, and the case against the 11 human rights workers will continue. But eight of the accused who were still being held in prison, including the two foreign citizens, were ordered released by the judge. Two of the Turkish citizens will remain under a travel ban, preventing them from traveling abroad.

When 10 of the human rights leaders were detained by the police in July as they were attending a workshop at a resort hotel on Buyukada, one of the Princes’ Islands, near Istanbul, Turkey’s nongovernmental and civil society organizations were shaken.

The charges against the workers — that they were aiding a terrorist organization — were similar to those being used to detain tens of thousands of Turkish citizens since the failed coup.