Nuriye Gulmen, a literature professor, and Semih Ozakca, a primary school teacher, who have been on hunger strike after they both lost their jobs in a crackdown following a failed July coup against President Tayyip Erdogan, take part in a protest against a government purge in Ankara, Turkey, May 11, 2017. REUTERS/Stringer

ANKARA (Reuters) - A Turkish teacher who has been on hunger strike for months to protest about losing his job in the government’s purge since a failed coup attempt last year, has been released from jail pending her trial on terrorism-related charges.

Defence lawyers said primary school teacher Semih Ozakca, 28, was released, but another detainee, literature professor Nuriye Gulmen, 35, who has also survived for seven months on water, herbal tea and sugar and salt solutions, was remanded in custody.

The Ankara court released Ozakca on condition that he wears an ankle monitor. Gulmen, who has been hospitalized due to her worsening health, was ordered to remain in custody until the trial, which resumes on Nov. 17.

The pair began their hunger strike before being jailed. A court ordered their detention pending trial after ruling that their protest was being conducted on behalf of an outlawed far-left group, DHKP-C. Both deny any links to the group.

The teachers said their hunger strike aimed to highlight the plight of some 150,000 state employees - including academics, civil servants, judges and soldiers - suspended or sacked since the abortive coup in July 2016.

Turkish authorities blame the coup attempt on U.S.-based Muslim cleric Fethullah Gulen and his supporters. Gulen denies involvement.

Human rights groups and the European Union have said President Tayyip Erdogan is using the crackdown to stifle dissent in Turkey, something he denies.

(This version of the story was refiled to correct the gender of Ozakca throughout)