ISTANBUL — A Turkish court on Wednesday handed down prison sentences to a group of journalists and employees working for a Turkish opposition newspaper on terrorism-related charges, in a case that has focused attention on the erosion of press freedoms under President Recep Tayyip Erdogan.

 Fourteen of the defendants, who work for Cumhuriyet, one of Turkey’s oldest newspapers, were given sentences of up to 7½ years. The defendants have been released from custody, pending an appeal. Three other employees were acquitted.  

 The journalists were arrested in the months following an attempted coup in 2016 that the authorities blamed on Fethullah Gulen, a Turkish cleric living in exile in the United States. Thousands of people who were accused of aiding the coup plotters were arrested or dismissed from government jobs. However, the authorities also targeted opposition politicians, journalists and dissidents who played no part in the coup, human rights advocates said.

 Gulen has denied any involvement in the coup attempt.   

 Lawyers for the Cumhuriyet staff members, who were charged with aiding terrorist organizations, have called the accusations baseless and said they stemmed from the newspaper’s frequent opposition to Erdogan’s government. The paper, which is associated with Turkey’s mainstream opposition, was frequently critical of Gulen and his followers.  

 Press advocates said the prosecution of the newspaper’s employees was part of a broader attack by Turkish authorities on the news media that included the closure of independent news outlets, the arrest of journalists and the consolidation of media outlets under government-friendly owners. 

 Can Atalay, a lawyer for Ahmet Sik, one of the journalists on trial, said the harsh sentences were a surprise, if only because they exceeded the prison terms handed down in other cases to actual members of Gulen’s movement. Those sentenced on Wednesday included the paper’s cartoonist, Musa Kart, and Aydin Engin, a 78-year-old columnist.  

“This part is incomprehensible,” Atalay said, in a videotaped interview that was published on Cumhuriyet’s website. “This is not a state of law.”

 The sentences could have a chilling effect on the news media at a critical moment, with Turkey heading toward elections in late June that could give Erdogan enhanced powers.   

 “Doing journalism in Turkey in these circumstances — just to make the news, just to arrange a front page, just to make a headline — will be much more difficult than yesterday,” Atalay said.