Egypt's President Abdel-Fattah el-Sissi overruled a powerful branch of the judiciary by appointing its new leader on Wednesday, risking a backlash from the judges, who had nominated another candidate.

El-Sissi named Ahmed Abul-Azm as head of the State Council, which rules on disputes between the government and citizens. The appointment ignores the choice of council judges who, in violation of a widely disputed law, voted overwhelmingly in May to nominate Yahya Dakroury, their most senior justice, for the job.

Dakroury gained nationwide fame last year when he ruled to annul an April 2016 agreement to surrender two Red Sea islands to Saudi Arabia. El-Sissi's government insists the islands have always been Saudi, but were placed under Egypt's protection amid rising Arab-Israeli tensions in the early 1950s.

El-Sissi has argued in support of the islands' Saudi ownership, a stand that many Egyptians find vexing given that one of the two islands, Tiran, has a strong strategic value. It controls a narrow shipping lane leading north to the port cities of Eilat and Aqaba, in Israel and Jordan respectively.

Parliament hurriedly debated and approved the agreement last month in a series of charged and chaotic sessions, and el-Sissi ratified it, slamming shut an issue that sparked the largest anti-government protests since he took office in June 2014.

Critics say the surrender of the islands amounts to a pay-off to the Saudis, who have provided billions of dollars in aid to help prop up Egypt's economy.

A new law enacted in April allows the president to select the leader of each branch of the judiciary from three names submitted by its members. Previously, each branch had nominated its most senior member, and presidential approval was mainly a formality.

The State Council, signaling its opposition to the law, only nominated Dakroury.