An gun-wielding assailant attempted to shoot a prominent Turkish journalist outside an Istanbul courthouse on Friday, just before the verdict in his trial on charges of revealing state secrets was due to be announced.

The assailant shouted "traitor" before firing at least three shots in quick succession at Can Dundar, a Reuters eyewitness said. Dundar, the editor in chief of the opposition Cumhuriyet newspaper, was unharmed but a reporter covering his trial appeared to have been injured, the witness said.

Crowds of reporters were waiting outside the courthouse for the verdict in the closed-door trial. The case has drawn international criticism of the EU candidate nation's press freedom record.

Dundar and Erdem Gul, the newspaper's Ankara bureau chief, could face life in jail on espionage charges and attempting to topple the government for publishing footage that purported to show Turkey's state intelligence agency ferrying weapons into Syria in 2014.

Their lawyers said the prosecutor did not seek the espionage charge in his closing statement, but nonetheless called for Dundar to be jailed for 25 years for procuring and revealing state secrets and Gul for to be jailed for 10 years for publishing them.

President Recep Tayyip Erdogan, who joined the trial as a complainant, accused the men of undermining Turkey's international reputation and vowed Dundar would "pay a heavy price", raising opposition concerns the case was politicized.

Erdogan has acknowledged that the trucks, which were stopped by gendarmerie and police officers en route to the Syrian border in January 2014, belonged to the National Intelligence Organisation and said they were carrying aid to Turkmen battling both Syrian President Bashar al-Assad and the Islamic State group.

Gul and Dundar spent 92 days in jail, almost half of it in solitary confinement, before the constitutional court ruled in February that pre-trial detention was unfounded because the charges stemmed from their journalism. Erdogan said he did not respect that ruling.