UNITED NATIONS — In the midst of Israel’s battle with militants in Gaza over the past three weeks, skirmishes opened on a second front in recent days: Its strikes on United Nations facilities and the steep civilian casualties brought a barrage of rebukes and warnings from senior United Nations officials around the world, reaching a fever pitch just before the announcement of a cease-fire late Thursday.

Behind the scenes, diplomats here were on the phone incessantly with Israelis, Palestinians and representatives of countries in the region that have influence over Israel’s principal nemesis, Hamas. The efforts led to a 72-hour humanitarian cease-fire announced late Thursday by Secretary General Ban Ki-moon’s spokesman and by Secretary of State John Kerry, who was traveling in New Delhi.

In public, the war of words intensified this week, with the United Nations blaming Israel for an attack that killed at least 19 people who were taking refuge at a United Nations school early Wednesday and Israel, in turn, accusing the world body of helping Hamas.

The United Nations has been dragged into the conflict: Eight of its staff members have been killed in the past 24 days, and more than 100 of its facilities have come under fire, including the school. United Nations officials said they had repeatedly told Israel of its exact location.