Plainclothes police officers aim their guns at an assailant who attempted to shoot prominent Turkish journalist Can Dundar outside a courthouse in Istanbul on May 6. Dundar was not hurt. (Reuters)

A Turkish court sentenced two prominent journalists to five years in prison for “divulging state secrets” Friday in a high-profile case that has drawn international scrutiny — just hours after one of the reporters was nearly killed in an assassination attempt outside the courthouse in Istanbul.

Can Dundar, editor in chief of Turkey’s daily Cumhuriyet newspaper, escaped the attack by an armed assailant unscathed but was then handed the five-year sentence for publishing a report on the government’s alleged smuggling of arms to Syrian rebels.

His colleague, Ankara bureau chief Erdem Gul, was also convicted for his part in publishing the report. Dundar and Gul were acquitted of separate charges of espionage and conspiring to topple the government.

The report, published in May 2015, was based on footage purporting to show Turkish intelligence facilitating weapons transfers to rebels across the border in Syria. The incident, which took place early in 2014, came to light after Turkish paramilitary and police forces halted trucks reportedly transporting the weapons.

Rights groups have condemned the proceedings and urged Turkish authorities to drop the charges. The Turkey researcher for Human Rights Watch, Emma Sinclair-Webb, called the trial “monstrous” Friday.

Media watchdog Reporters Without Borders blasted the case as “autocratic retribution” from Turkish President Recep Tayyip Erdogan, who was named as a complainant in the suit.

Critics say the president has grown increasingly authoritarian, jailing dissidents and pushing for a stronger role for the country’s executive that would neuter the parliament.

On Thursday, Prime Minister Ahmet Davutoglu announced his resignation amid a public rift with Erdogan, who analysts say seeks to replace Davutoglu with a more pliant premier.

The turmoil has raised concerns that a deal between Turkey and the European Union to stem the flow of migrants to Europe will unravel.

Davutoglu spearheaded Turkey’s negotiations with Europe over the deal, which calls for the return of migrants to Turkey in exchange for aid and other incentives, including visa-free travel for Turks on the continent and the reopening of E.U. membership talks.

The E.U. has called on Turkey to revise its legal definition of terrorism, which rights advocates say is too broad and has been used by the state to target journalists and other dissidents.

On Friday, the assailant who attacked Dundar called out “traitor” as he approached the Istanbul courthouse and fired two shots at the journalist.

“I am fine,” Dundar posted on his Twitter feed after the attack. He said it was those who turned journalists into targets who were responsible.