Israel and Hamas announced a deal on Wednesday allowing at least 50 hostages and scores of Palestinian prisoners to be freed, while offering besieged Gaza residents a four-day truce after weeks of all-out war.
In the first major diplomatic breakthrough in the war, Palestinian militants will release during a four-day truce 50 women and children kidnapped during their October 7 raids.
After weeks of Qatar-brokered negotiations, Israeli Prime Minister Benjamin Netanyahu's cabinet approved the truce accord Wednesday after a near-all-night meeting, in which he told ministers this was a "difficult decision but it's a right decision."
The cabinet's sign-off was one of the last stumbling blocks after what one US official described as five "extremely excruciating" weeks of talks.
Hamas released a statement welcoming the "humanitarian truce" and said it would also see 150 Palestinians released from Israeli jails.
"The resistance is committed to the truce as long as the occupation honours it," a Hamas official told AFP.
Hamas gunmen carried out on October 7 a cross-border attack, the worst in Israel's history, that left around 1,200 people dead, most of them civilians, according to the Israeli government.
Hamas and other Palestinian militant groups also took an estimated 240 Israelis and foreigners hostage, among them elderly people and young children.
Israel declared war on Hamas, vowing to bring the hostages home and to destroy the militant group.
It launched a major bombing campaign and ground offensive in Gaza, which, according to the Hamas government in the territory, has killed 14,100 people, thousands of them children.
Israel said that to facilitate the hostage release it would initiate a four-day "pause" in its six-week-old air, land and sea assault of Gaza, while it stressed that the agreement did not spell the end of the war.
For every 10 additional hostages released, there would be an extra day's "pause", the Israeli government said.
- 'Brave souls' -
Sources from Hamas and Islamic Jihad, another militant group that took part in the October 7 attacks, had earlier told AFP the truce would include a ceasefire on the ground and a pause in Israeli air operations over southern Gaza.
The negotiations have involved the US Central Intelligence Agency, Israel's overseas spy agency Mossad, Egyptian intelligence, and leaders in Doha, Cairo, Washington, Gaza and Israel.
A senior US official said three Americans, including three-year-old Abigail Mor Idan, were among the 50 earmarked for staggered release from Thursday.
US President Joe Biden said he was "extraordinarily gratified that some of these brave souls... will be reunited with their families once this deal is fully implemented".
Qatar's foreign ministry confirmed the deal, saying that "a number of Palestinian women and children detained in Israeli prisons" would be released in exchange for the hostages.
"The starting time of the pause will be announced within the next 24 hours and last for four days, subject to extension," the ministry said.
- Misgivings -
Ahead of the Israeli cabinet vote, Netanyahu had faced criticism from within his right-wing coalition, some of whom thought the deal gave too much to the Palestinian militants.
Hardline Minister for National Security Itamar Ben-Gvir signalled he would vote against the agreement, saying it should include the release of Israeli soldiers also taken by Hamas.
But with dozens of families in Israel who are beyond desperate to have their loved ones returned home, and the Israeli public gripped by the hostages' fate, the government ultimately set aside any misgivings.
Israel's hawkish Defence Minister Yoav Gallant said before the crunch meeting that he had won assurances that the deal would not spell the end of the war.
"Immediately after we have exhausted this phase" he said, security operations would "continue in full force."
In a statement, the Israeli government underscored that the truce agreement would not mean the end of the war in Gaza.
Israel "will continue the war in order to return home all of the hostages, complete the elimination of Hamas and ensure that there will be no new threat to the State of Israel from Gaza," the government statement said.
- 'Unbearable situation' -
Earlier, Gaza resident Hamza Abdel Razeq said he would welcome any ceasefire agreement, hoping it would bring some respite for people who have endured Israel's bombing and expanding ground offensive.
"The people are really suffering," he told AFP. "I believe it will pave the way for longer truces or even a total ceasefire."
A US official said there was also hope that the deal would lead to a "full pause" in fighting along the Israel-Lebanon border between Israel and Hezbollah, which like Hamas is backed by Iran.
Since the Israel-Hamas war began, the border has seen escalating exchanges of fire, killing scores on both sides.
Another Gaza resident, Mahmud Abu Najm, said: "We... pray to God for its success because the people are enduring an unbearable situation."
Large parts of Gaza have been flattened by thousands of air strikes, and the territory is under siege, with minimal food, water and fuel allowed in.
Six weeks into the war, Israel has come under intense international pressure to implement a humanitarian ceasefire.
But in recent days it has pressed its offensive into northern Gaza.
The Israeli military said air strikes had hit "around 250" Hamas targets in the past day, destroying three underground shafts in the Jabalia area, which it said it had fully surrounded.
At Jabalia's Indonesian Hospital, the Hamas-run health ministry said strikes had killed dozens, but there was no independent confirmation of the toll.
The Israeli army said later its troops had "directly targeted" the source of fire from within the Indonesian Hospital.
Doctors Without Borders (MSF) said three doctors, including two it employed, were killed in an Israeli strike on the Al-Awda hospital in Jabalia refugee camp.
Israel says Hamas uses medical facilities to hide fighters and as bases for operations, making them legitimate military objectives while insisting it does everything possible to limit harm to civilians.