ISTANBUL — Thousands gathered across Istanbul on Friday to protest the arrest of two prominent journalists on charges of espionage over a report alleging that the country’s intelligence services had sent arms shipments to Islamist rebels in Syria.

A court in Istanbul on Thursday ordered the arrest of Can Dundar, the editor in chief of the opposition newspaper Cumhuriyet, and of Erdem Gul, the newspaper’s Ankara bureau chief, on charges of divulging state secrets and being members of an armed terrorist organization. If found guilty, they would face life imprisonment. Demonstrations against the arrests were held in several parts of Istanbul, with the main rally held outside the newspaper’s headquarters Friday, where protesters chanted “shoulder to shoulder against fascism” and held up banners that denounced a “black day for the press.”

The arrests came after a wave of crackdowns on opposition news media in Turkey that gained momentum after the Justice and Development Party regained its parliamentary majority in elections this month. The result allowed President Recep Tayyip Erdogan to further secure his grip on power.

Mr. Erdogan personally filed the criminal complaint against Cumhuriyet in June after he delivered a speech accusing the newspaper of engaging in acts of espionage, vowing that the author would “pay a heavy price.”