An Istanbul court on Friday sentenced Turkish journalist Can Dundar to five years and ten months in prison over a report last year about alleged arms shipments from Turkey to Syrian rebels.
Dundar, the editor-in-chief of the left-wing Turkish daily Cumhuriyet, was on trial with his colleague Erdem Gul, who was given a five-year prison sentence, according to a dpa reporter in the courtroom.
Hours before his guilty verdict and jail sentence were announced, Dundar survived an attack by a gunman outside the courthouse.
The gunman, who shouted "you're a traitor to your country" while firing at the Dundar, was quickly arrested without resistance.
Dundar was not injured in the attack and the trial resumed.
The two journalists could have faced life in prison.
President Recep Tayyip Erdogan, a plaintiff in the case along with the Turkish secret service, had promised the pair would pay a "heavy price."
Both Dundar and Gul spent three months in jail on remand before the Constitutional Court ordered their release in late February.
The trial began on March 25, with the public being excluded from observing proceedings, sparking outrage among leading human rights groups.
Turkey ranks 161 out of 180 countries in the Reporters Without Borders Press Freedom Index.