ISTANBUL (Reuters) - Turkey released two prominent press-freedom activists from prison on Thursday following international condemnation of their detention, but their prosecution on terrorism-related charges will proceed, a lawyer said.

Erol Onderoglu of Reporters Without Borders (RSF) and Sebnem Korur Fincanci, president of Turkey's Human Rights Foundation, were freed by a court, lawyer Fikret Ilkiz told Reuters.

Journalist Ahmet Nesin, jailed with Fincanci and Onderoglu on June 20, remained in pre-trial detention, media said.

U.N. Secretary-General Ban Ki-moon said last week the arrests caused great concern and called for Onderoglu to be prompted freed.

Turkey, a candidate for the European Union, ranks 151 out of 180 nations on RSF's World Press Freedom Index. RSF accuses Erdogan of an "offensive against Turkey's media" that includes censorship and harassment. Up to 30 journalists are in jail.

The indictment against the three activists calls for up to 14-1/2 years in prison on charges of terrorist propaganda after they joined a "solidarity campaign" with 50 others to guest-edit the pro-Kurdish newspaper Ozgur Gundem for a day each.

Ozgur Gundem focuses on Turkey's conflict with Kurds fighting for autonomy and has faced scores of investigations, fines and the arrest of a dozen correspondents since 2014.

The government denies jailing journalists for their work, saying they are prosecuted for criminal wrongdoing. Ankara is waging a military campaign to stamp out the renewal of a Kurdish insurgency. Thousands have been killed in the past year.

(Reporting by Ayla Jean Yackley; Editing by Mark Heinrich)