Behind the scenes, Egypt’s top generals have grown steadily closer to their Israeli counterparts since the signing of the Camp David accords 40 years ago, in 1978. Egyptian security forces have helped Israel enforce restrictions on the flow of goods in and out of the Gaza Strip, the Palestinian territory bordering Egypt controlled by the militant group Hamas. And Egyptian and Israeli intelligence agencies have long shared information about militants on both sides of the border.

Israeli officials were concerned in 2012 when Egypt, after its Arab Spring revolt, elected a leader of the Muslim Brotherhood to the presidency. The new president, Mohamed Morsi, pledged to respect the Camp David agreements. But the Israelis worried about the Muslim Brotherhood’s ideological kinship with Hamas and its historic hostility to the Jewish state itself.

A year later, Mr. Sisi, then the defense minister, ousted Mr. Morsi in a military takeover. Israel welcomed the change in government and urged Washington to accept it. That solidified the partnership between the generals on both sides of the border.

The North Sinai, a loosely governed region of mountainous desert between the Suez Canal and the Israeli border, became a refuge for Islamist militants in the decade before Mr. Sisi took power. The main jihadist organization, Ansar Beit al Maqdis — the Partisans of Jerusalem — had concentrated on attacking Israel, but after Mr. Sisi’s takeover it began leading a wave of deadly assaults against Egyptian security forces.

A few weeks after Mr. Sisi took power, in August 2013, two mysterious explosions killed five suspected militants in a district of the North Sinai not far from the Israeli border. The Associated Press reported that unnamed Egyptian officials had said Israeli drones fired missiles that killed the militants, possibly because of Egyptian warnings of a planned cross-border attack on an Israeli airport. (Israel had closed the airport the previous day.)

Mr. Sisi’s spokesman, Col. Ahmed Ali, denied it. “There is no truth in form or in substance to the existence of any Israeli attacks inside Egyptian territory,” he said in a statement at the time, promising an investigation. “The claims of coordination between the Egyptian and Israeli sides in this matter are totally lacking in truth and go against sense and logic.”