GAZA CITY, GAZA STRIP -- A ceasefire between Israel and Palestinian militants took effect late Sunday in a bid to end nearly three days of violence that killed dozens of Palestinians and disrupted the lives of hundreds of thousands of Israelis.

The flare-up was the worst fighting between Israel and Gaza militant groups since Israel and Hamas fought an 11-day war last year, and adds to the destruction and misery that have plagued blockaded Gaza for years.

The Egyptian-brokered ceasefire took effect at 11:30 p.m. (2030 GMT; 4:30 p.m. EDT). Israeli strikes and militant rockets continued in the minutes leading up to the beginning of the truce, and Israel said it would "respond strongly" if the ceasefire was violated.

Israeli aircraft have pummelled targets in Gaza since Friday, while the Iran-backed Palestinian Jihad militant group has fired hundreds of rockets at Israel in response. The risk of the cross-border fighting turning into a full-fledged war remained as long as no truce was reached. Israel says some of the dead were killed by misfired rockets.

Gaza's ruling Hamas group remained on the sidelines, possibly because it fears Israeli reprisals and undoing economic understandings with Israel, including Israeli work permits for thousands of Gaza residents, that bolster its control.

Israel launched its operation with a strike Friday on a leader of the Islamic Jihad, and followed up on Saturday with another targeted strike on a second prominent leader.

The second Islamic Jihad commander, Khaled Mansour, was killed in an airstrike on an apartment building in the Rafah refugee camp in southern Gaza late Saturday, which also killed two other militants and five civilians.

Mansour, the Islamic Jihad commander for southern Gaza, was in the apartment of a member of the group when the missile struck, flattening the three-story building and badly damaging nearby houses.

"Suddenly, without warning, the house next to us was bombed and everything became black and dusty with smoke in the blink of an eye," said Wissam Jouda, who lives next to the targeted building.

Ahmed al-Qaissi, another neighbour, said his wife and son were among the wounded, suffering shrapnel injuries. To make way for rescue workers, al-Qaissi agreed to have part of his house demolished.

As a funeral for Mansour began in the Gaza Strip on Sunday, the Israeli military said it was striking suspected "Islamic Jihad rocket launch posts." Smoke could be seen from the strikes as thumps from their explosions rattled Gaza. Israeli airstrikes and rocket fire followed for hours as sirens wailed in central Israel. As the sunset call to prayer sounded in Gaza, sirens wailed as far north as Tel Aviv.

Israel says some of the deaths during this round were caused by errant rocket fire, including one incident in the Jebaliya refugee camp in northern Gaza in which six Palestinians were killed Saturday. On Sunday, a projectile hit a home in the same area of Jebaliya, killing two men. Palestinians held Israel responsible, while Israel said it was investigating whether the area was struck by an errant rocket.

Israel's Defence Ministry said mortars fired from Gaza hit the Erez border crossing into Israel, used by thousands of Gazans daily. The mortars damaged the roof and shrapnel hit the hall's entrance, the ministry said. The crossing has been closed amid the fighting.

The Rafah strike was the deadliest so far in the current round of fighting, which was initiated by Israel on Friday with the targeted killing of Islamic Jihad's commander for northern Gaza.

Israel said it took action against the militant group because of concrete threats of an imminent attack, but has not provided details. Caretaker Prime Minister Yair Lapid, who is an experienced diplomat but untested in overseeing a war, unleashed the offensive less than three months before a general election in which he is campaigning to keep the job.

In a statement Sunday, Lapid said the military would continue to strike targets in Gaza "in a pinpoint and responsible way in order to reduce to a minimum the harm to non-combatants." Lapid said the strike that killed Mansour was "an extraordinary achievement."

"The operation will continue as long as necessary," Lapid said.

U.S. President Joe Biden said he welcomed the ceasefire between Israel and Gaza-based militants.

"Over these last 72-hours, the United States has worked with officials from Israel, the Palestinian Authority, Egypt, Qatar, Jordan, and others throughout the region to encourage a swift resolution to the conflict," he said in a statement.

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

"We underscore our commitment to do all we can towards ending the ongoing escalation, ensuring the safety and security of the civilian population, and following-up on the Palestinian prisoners file," said UN Special Coordinator for the Middle East Peace Process, Tor Wennesland, in a statement.

Israel estimates its airstrikes killed about 15 militants.

Islamic Jihad has fewer fighters and supporters than Hamas, and little is known about its arsenal. Both groups call for Israel's destruction, but have different priorities, with Hamas constrained by the demands of governing.

The Israeli army said militants in Gaza fired about 580 rockets toward Israel. The army said its air defences had intercepted many of them, with two of those shot down being fired toward Jerusalem. Islamic Jihad has fewer fighters and supporters than Hamas.

Air raid sirens sounded in the Jerusalem area for the first time Sunday since last year's Israel-Hamas war.

Jerusalem is typically a flashpoint during periods of cross-border fighting between Israel and Gaza. On Sunday, hundreds of Jews, including firebrand ultra-nationalist lawmaker Itamar Ben Gvir, visited a sensitive holy site in Jerusalem, known to Jews as the Temple Mount and to Muslims as the Noble Sanctuary. The visit, under heavy police protection, ended without incident, police said.

Such demonstrative visits by Israeli hardliners seeking to underscore Israeli claims of sovereignty over contested Jerusalem have sparked violence in the past. The holy site sits on the fault line of the Israeli-Palestinian conflict and is central to rival narratives of Palestinians and Israeli Jews.

In Palestinian cities and towns in the West Bank, Israeli security forces said they detained 19 people on suspicion of belonging to the Islamic Jihad during overnight raids.

By Sunday, Hamas still appeared to stay out of the battle. The group has a strong incentive to avoid another war. Last year's Israel-Hamas war, one of four major conflicts and several smaller battles over the last 15 years, exacted a staggering toll on the impoverished territory's 2.3 million Palestinian residents.

Since the last war, Israel and Hamas have reached tacit understandings based on trading calm for work permits and a slight easing of the border blockade imposed by Israel and Egypt when Hamas overran the territory 15 years ago. Israel has issued 12,000 work permits to Gaza laborers, and has held out the prospect of granting another 2,000 permits.

The lone power plant in Gaza ground to a halt at noon Saturday due to lack of fuel. Israel has kept its crossing points into Gaza closed since Tuesday. With the new disruption, Gazans can use only four hours of electricity a day, increasing their reliance on private generators and deepening the territory's chronic power crisis amid peak summer heat.

------

Goldenberg reported from Tel Aviv, Israel. Associated Press writer Edith M. Lederer in New York contributed.