Israel and Hamas, the Islamist group that rules the Gaza Strip, agreed on a truce on Thursday, two Palestinian officials said, an understanding that would end an escalation in fighting that has drawn mutual threats of war.

There was no formal comment from Israel, but an Israeli official who spoke on condition of anonymity denied a cease-fire had been reached. Israel rarely acknowledges reaching any such agreement with Hamas, a group it designates as a terrorist organization and with which it has fought three wars in the past decade.

A surge in cross-border rockets and airstrikes in recent weeks have prompted the United Nations and Egypt to try to broker a truce to prevent another all-out conflict.