ISTANBUL - An Istanbul court on Thursday ordered the release of one of Turkey's most celebrated novelists after over four months in jail on charges of terror propaganda, as the authorities detained a leading investigative journalist over his tweets.

Novelist Asli Erdogan has been held in jail for 132 days since her detention over her links to a pro-Kurdish newspaper, in a case that has caused an international outcry over freedom of expression in the country. Also ordered released in the same case was Necmiye Alpay, an internationally prominent linguist and author of widely praised translations of Western novels into Turkish. She has been held behind bars for 120 days.

They were taken into custody in August as part of a probe into the now shut-down pro-Kurdish newspaper Ozgur Gundem, which the authorities regard as a mouthpiece for the outlawed Kurdistan Workers' Party (PKK).

As is customary in Turkey, they were not released at the courthouse but taken back to their prison in Bakirkoy in Istanbul to complete formalities.

One of Erdogan's supporters, Aysegul Tozeren, who followed the trial confirmed the release order and said she was expected to walk free later in the evening. They remain on trial with the next hearing scheduled for January.

The court also ordered the release of the paper's editorial director Zana Kaya.

But the authorities on Thursday detained prize-winning journalist Ahmet Sik in a separate case over a succession of tweets and articles for an opposition daily.

Sik was detained on accusations of making "terror propaganda" and denigrating the Turkish Republic, the judicial authorities and police, according to the state-run Anadolu news agency.

It said he had been detained over tweets about the PKK, as well as articles for the Cumhuriyet opposition daily that criticised the Turkish secret services.

In her defence statement to a packed court in Istanbul, Asli Erdogan ridiculed the charges against her and asked for her release. "I will defend myself as if the laws existed," she said, quoted by the Hurriyet daily.

"I am a writer and the purpose of my existence is to tell a story," she said.

Including Erdogan, 49, and Alpay, 70, a total of nine suspects linked to Ozgur Gundem have been charged in the case but not all have been under arrest.

Erdogan is no relation to Turkish President Recep Tayyip Erdogan - the name is common in Turkey.

She has published several well-received novels including "The City in Crimson Cloak", which has also been translated into English.

"They are being prosecuted for writings and thoughts that are in no way reprehensible according to Turkish law," said Baris Yarkadas, Istanbul MP for the opposition Republican People's Party (CHP).

Activists worry about a drastically worsening climate for journalists in Turkey, in particular since the state of emergency imposed in the wake of the July 15 coup.

According to the P24 Platform for Independent Journalism, 118 journalists have been arrested during the state of emergency, 80 of them within the coup probe.

The author of several books, Sik is one of the best-known journalists in the country and had already endured a lengthy spell in jail from 2011-2012.

He was imprisoned for 375 days during the investigation into the so-called Ergenekon alleged coup plot against the government.

That case was strongly supported by Fethullah Gulen, the US-based cleric whom Ankara blames for the failed putsch against President Erdogan.

But the convictions were quashed and suspects released amid accusations Gulen had perverted the process.

He has won numerous awards, including the UNESCO/Guillermo Cano World Press Freedom Prize in 2014.

Sik's books include notably one of the few full-scale investigations into the group of Gulen, the former ally of Erdogan and now his arch foe.

The book, called "The Imam's Army" examines how Gulen supporters infiltrated the Turkish bureaucracy and built up an alliance with the ruling party that has since collapsed.

The book had not even been published when Sik was arrested in March 2011 and was eventually released in November 2011 under the title "000Kitap" ("000Book"), causing a sensation with its author still in jail.