After nearly three days of fighting, Israel and Palestinian militants agreed to a cease-fire, and Gaza’s sole power plant reopened Monday as Israel reopened crossings into the territory.

After the Egyptian-mediated truce went into effect late Sunday, Israel also lifted security restrictions in southern Israeli communities. Fighting ceased, leaving war-weary residents of Gaza and Israel to pick up the pieces after another round of violence — the worst since an 11-day war between Israel and Hamas last year.

Israeli aircraft have bombed targets in Gaza since Friday, while the Iran-backed Palestinian Islamic Jihad militant group has fired hundreds of rockets at Israel.

According to the Palestinian Health Ministry, 44 Palestinians were killed over three days of fighting, including 15 children and four women, and 311 were injured. According to Islamic Jihad, 12 of those killed were militants. Israel claimed that some of those killed were killed by rockets fired from Gaza. There were no Israelis killed.

The violence had threatened to escalate into another all-out war, but it was averted because Gaza’s ruling Hamas group remained on the sidelines, possibly due to fear of Israeli retaliation and the unraveling of economic agreements with Israel, such as Israeli work permits for thousands of Gaza residents, which bolster Hamas’ control over the coastal strip.

Since the group took over the territory in 2007, Israel and Hamas have fought four wars. Hamas had a strong incentive to avoid further conflict, which has wreaked havoc on the impoverished territory’s 2.3 million Palestinian residents.

The outbreak of violence in Gaza was a major litmus test for Israel’s caretaker Prime Minister Yair Lapid, who has little experience leading military operations. He launched the offensive less than three months before a general election in which he is running for re-election — and may have gained political ground as a result.

On Monday, Israel reopened humanitarian crossings into Gaza and said it would fully reopen them if calm prevailed. Fuel trucks were seen entering the main cargo crossing on their way to the power plant, which was shut down Saturday after Israel closed the crossings into Gaza last week.

Life for hundreds of thousands of Israelis was disrupted during the violence. Israel’s sophisticated Iron Dome missile defense system intercepted many of the rockets launched at Israel and no significant injuries were reported.

In response to the arrest last week of another senior Islamic Jihad member in the West Bank, Israel launched its operation with a strike on a leader of the Islamic Jihad on Friday, saying there were “concrete threats” of an anti-tank missile attack against Israelis. This arrest came after months of Israeli raids in the West Bank to apprehend suspects in the aftermath of a wave of Palestinian attacks on Israel.

Both sides boasted about their achievements. Islamic Jihad leader Ziad al-Nakhalah told reporters in Tehran on Sunday that the militant group remained strong despite the loss of two of its leaders. “This is a win for Islamic Jihad,” he declared.

Regardless of that claim, the group undoubtedly suffered a setback during the fierce offensive. Beyond losing the two leaders, it reduced its arsenal by firing hundreds of rockets.

Israel claimed that errant militant rocket fire was to blame for some of the deaths in Gaza, including six Palestinians killed Saturday in the Jebaliya refugee camp. On Sunday, a projectile struck a home in the same Jebaliya neighborhood, killing two men. Palestinians blamed Israel for the attack on Sunday, while Israel said it was investigating whether the area was hit by misfired rockets.

The cease-fire agreement stated that Egypt would work to free two senior Islamic Jihad detainees held by Israel, but there were no guarantees that this would happen. The weekend fighting was also likely to aggravate Islamic Jihad’s relationship with Hamas.

According to a senior Israeli diplomatic official, the offensive was successful and pushed Islamic Jihad’s capabilities back “decades,” citing the loss of two leaders as well as blows to the group’s rocket production and firing capabilities. He spoke on the condition of anonymity because he was not authorized to speak to the media about the operation.

The United Nations Security Council was scheduled to hold an emergency meeting on the violence on Monday. The session was scheduled by China, which holds the council presidency this month, in response to a request from the United Arab Emirates, which represents Arab nations on the council alongside China, France, Ireland, and Norway.