Next story in Israel-Palestinians

JERUSALEM — Gaza militants agreed to a cease-fire with Israel to stop three days of violence, a Hamas official said Sunday, after a deadly attack on Israelis near the Egypt-Israel border set off a round of Israeli airstrikes and rocket barrages from Gaza.

The sudden flareup also threatened Israel-Egypt relations, after Egypt said five of its policemen were killed by Israeli fire as Israel's troops and aircraft pursued the militants responsible for killing eight people Thursday. Egypt complained strongly as thousands demonstrated in Cairo, and Israel apologized.

The senior Hamas official said Sunday afternoon that militant groups in Gaza agreed that the truce would go into effect Sunday evening. Hamas security personnel would enforce the agreement brokered by Egypt, the official said. He said Egypt told the groups that Israel would agree to halt its airstrikes only if the Palestinians stopped the rocket fire first.

A spokesman for Israel's government would not comment, and it was not clear if the cease-fire indeed had the backing of all of Gaza's armed factions.

Palestinian rocket fire and Israeli airstrikes continued hours after the cease-fire was to take effect at 9 p.m. local time.

Earlier Sunday, a salvo of rockets from Gaza struck an empty school and sent thousands of Israelis into bomb shelters. Israel responded with airstrikes and diplomats scrambled to limit the violence.

The diplomatic efforts were also aimed at limiting the damage from the deaths of the Egyptian policemen. On Sunday morning, an Israeli envoy arrived at Cairo's international airport and was whisked off in a convoy of four waiting cars, airport officials said. Israel's government would not comment on the envoy's identity or the details of his mission. A second unidentified envoy arrived later Sunday, the Egyptian officials said. France and Germany were also working with the Israelis and Egyptians to end the diplomatic spat, the officials said, speaking on condition of anonymity in order to discuss ongoing diplomatic efforts.

U.S. Assistant Secretary of State Jeffrey Feltman also arrived to help mediate, according to an official at the American Embassy in Cairo, speaking on condition of anonymity because he was not authorized to speak to reporters.

Alongside the diplomacy, Israel threatened to intensify its attacks if the rocket barrages continue.

Speaking to Israel Radio, military spokesman Brig. Gen. Yoav Mordechai said Israel "will not hesitate" to widen its military operation if necessary. Diplomats scrambled to try to prevent the violence — the deadliest since Israel went to war against Gaza militants 2 1/2 years ago — from spiraling out of control.

Large-scale Israeli military operations in Gaza would create new friction with the Muslim world at a time when Palestinian President Mahmoud Abbas is preparing to ask the United Nations to recognize an independent Palestinian state. Pictures of a major Israeli offensive in Gaza could hurt the Jewish state's efforts to minimize world support for the Palestinian statehood bid.

A spokesman said Abbas' Palestinian Authority planned to use the renewed violence to bolster its case for statehood at the United Nations next month.

"An independent Palestinian state is the remedy for violence," Husam Zomlot said. "It would control its borders and prevent such deterioration from happening."

Abbas, who wields limited power in the West Bank under Israel's overall security control, asserts no such control at this time. Hamas routed his loyalists from Gaza in a violent 2007 takeover, and a reconciliation pact the two sides signed in May has stalled.

Hamas, backed by Iran, opposes both peacemaking with Israel and Abbas' statehood bid.

Under Hamas rule, Gaza's militants have increased the quality and range of their rocket arsenals and now target the largest city in Israel's south — Beersheba, 25 miles away from Gaza. Most of the rockets launched since Thursday have been military-grade Katyushas smuggled in through tunnels from Egypt.

Israel pulled out of Gaza in 2005.

Since Thursday's ambush, militants have fired some 100 rockets and mortars into Israel. On Saturday, rockets killed an Israeli man in Beersheba and seriously wounded two others.