Egyptian rights activists accuse President Abdel Fattah al-Sisi

An Egyptian court on Saturday sentenced the head of the journalists' union and two members to two years in prison for "harbouring fugitives", allowing them to pay bail pending an appeal.

Journalists Syndicate president Yahiya Kallash, Gamal Abd el-Rahim and Khaled Elbalshy were charged in May with sheltering two journalists wanted over protests against the transfer of two Red Sea islands to Saudi Arabia.

The court set bail at 10,000 Egyptian pounds ($615, 580 euros), a court official said.

Their arrest following a May 1 police raid on the union building to detain two reporters from an opposition website drew condemnation from rights groups.

The New York-based Committee to Protect Journalists condemned the court ruling.

The three were being punished "for working to protect journalists from harassment, threats, and arrests," the CPJ's Middle East and North Africa program coordinator Sherif Mansour said in a statement.

The European Union had said the indictment of the journalists' syndicate members was "a worrying development".

"It reflects broader limitations on freedom of expression and press freedom in Egypt," an EU spokesperson said at the time.

Rights activists accuse President Abdel Fattah al-Sisi of running an ultra-authoritarian regime that has violently suppressed all opposition since toppling Islamist president Mohamed Morsi in 2013.

Kallash had denounced the police raid on the union headquarters to arrest reporters Amr Badr and Mahmud al-Sakka, saying the government was "escalating the war against journalism and journalists".

Activists had organised two protests in April against handing the islands to Saudi Arabia.

A court later ruled that the transfer could not go through.