Israel and Hamas agreed on Thursday to the first phase of a Gaza ceasefire aimed at ending a war that has killed tens of thousands, razed the Palestinian territory and unleashed a major humanitarian crisis.
The deal, to be signed Thursday, includes the release of hostages and prisoners as well as a surge of aid into Gaza after more than two years of war started by Hamas's unprecedented October 2023 attack on Israel.
Palestinian militant group Hamas would release all hostages while Israel would pull its troops back to an agreed on line, US President Donald Trump said after talks in Egypt on his 20-point peace plan resulted in a deal.
Qatar said the deal was the "first phase of the Gaza ceasefire agreement, which will lead to ending the war, the release of Israeli hostages and Palestinian prisoners, and the entry of aid".
Hamas will exchange 20 living hostages for nearly 2,000 Palestinian prisoners as part of the first phase of a deal, a source within the militant group told AFP Thursday.
The exchange will take place within 72 hours of the implementation of the agreement, which is expected to be signed on Thursday, the source familiar with the negotiations said.
The hostages will be released in exchange for 250 Palestinians sentenced to life imprisonment and 1,700 others arrested by Israel since the war began, the source added.
"I am very proud to announce that Israel and Hamas have both signed off on the first Phase of our Peace Plan," Trump said on his Truth Social network.
"This means that ALL of the Hostages will be released very soon, and Israel will withdraw their Troops to an agreed upon line as the first steps toward a Strong, Durable, and Everlasting Peace."
Trump also thanked mediators Qatar, Egypt and Turkey, adding: "BLESSED ARE THE PEACEMAKERS!"
Israeli Prime Minister Benjamin Netanyahu said he would bring the hostages home "with God's help".
Trump said earlier that he may travel to the Middle East this week as a deal was "very close".
In a dramatic moment, AFP journalists saw US Secretary of State Marco Rubio interrupt an event at the White House and hand Trump an urgent note about the progress of the negotiations in Egypt.
"I may go there sometime toward the end of the week, maybe on Sunday," Trump said, adding that he was "most likely" to turn up in Egypt but would also consider going to war-torn Gaza.
Trump's plan called for a ceasefire, the release of all the hostages held in Gaza, Hamas's disarmament and a gradual Israeli withdrawal from the territory.
Trump's son-in-law Jared Kushner and Middle East envoy Steve Witkoff arrived at the talks earlier.
- 'Optimism prevails' -
As night fell in the coastal area of Al-Mawasi in southern Gaza, an AFP contributor described an atmosphere of anticipation before the announcement, with joyful chants of "Allahu akbar", meaning God is the greatest, and some celebratory gunfire into the air.
"We're closely following every bit of news about the negotiations and the ceasefire," said 50-year-old Mohammed Zamlot, who had been displaced from northern Gaza.
Hamas had submitted a list of Palestinian prisoners it wants released from Israeli jails in the first phase of the truce.
In exchange, Hamas is set to free the remaining 47 hostages, both alive and dead, who were seized in its October 7, 2023 attack on Israel which sparked the war.
Qatar's prime minister and Turkey's intelligence chief were also expected at the talks on Wednesday.
Hamas said it would be joined by delegations from Islamic Jihad -- which has also held some of the hostages in Gaza -- as well as the Popular Front for the Liberation of Palestine.
The negotiations were taking place under the shadow of the second anniversary of the 2023 Hamas attack on Israel, which resulted in the deaths of 1,219 people, mostly civilians, according to an AFP tally based on official Israeli figures.
Militants also took 251 people hostage into Gaza, where 47 remain, including 25 the Israeli military says are dead.
Israel's military campaign in Gaza has killed at least 67,183 people, according to the health ministry in the Hamas-run territory, figures the United Nations considers credible.
The data does not distinguish between civilians and combatants but indicates that more than half of the dead are women and children.
The territory's civil defence agency, a rescue force operating under Hamas's authority, said the bombardment of Gaza had not stopped in the hours before the deal. An AFP journalist in Israel near the Gaza border reported hearing multiple explosions in the morning.
- Protests, prisoners -
Global pressure to end the war has escalated, with much of Gaza flattened, a UN-declared famine unfolding and Israeli hostage families still longing for their loved ones' return.
One key to the negotiations was the names of the Palestinian prisoners Hamas pushed for.
High-profile inmate Marwan Barghouti -- from Hamas's rival, the Fatah movement -- is among those the group wanted to see released, according to Egyptian state-linked media.
Hamas's top negotiator, Khalil al-Hayya, also said the Islamist group wants "guarantees from President Trump and the sponsor countries that the war will end once and for all".