Hamas and Israel have carried out a prisoner exchange deal under a ceasefire agreement that saw the release of nearly 2,000 Palestinians imprisoned in Israeli jails and 20 Israeli captives held in the Gaza Strip.

Cheers broke out in Israel early on Monday, as television channels announced that the first lot of seven captives had been handed over to the International Committee of the Red Cross (ICRC). The Israeli military later confirmed that 13 more captives taken from Israel during the Hamas-led attack on October 7, 2023 were also transferred.

Later on Monday, Hamas’s military wing said it also planned to hand over the bodies of four dead captives later in the day.

The released Palestinians include some 1,700 seized from Gaza during the war and held without charge, as well as 250 held in Israeli prisons. The news of the release was bittersweet for the loved ones of some freed prisoners, as 154 of them were forced into exile.

‘We were tortured’

In southern Gaza’s Khan Younis, footage showed dozens of freed Palestinian detainees getting off buses near Nasser Hospital, surrounded by crowds of cheering onlookers.

“Medical teams are on standby at the hospital to examine those released after what officials described as years of harsh and degrading conditions in Israeli prisons,” reported Al Jazeera’s Tareq Abu Azzoum from the scene.

One freed prisoner, Shadi Abu Seed, said he faced years of abuse while in Israeli custody.

“I went hungry for the past two years,” he said upon being released. “I swear to God, they didn’t feed us. They kept us naked. They beat us while we were naked day and night. We were tortured.”

Among those waiting for the freed detainees was Yasser Abu Azzoum, whose 23-year-old son Mohammed was set to be released under the deal.

He told Al Jazeera the feeling was “indescribable”.

“I’m not able to speak properly because I am overwhelmed with joy,” he said.

Jubilant crowds also greeted a separate group of Palestinian prisoners freed in Ramallah in the occupied West Bank.

‘Looks great, although thin and pale’

In Israel, the Ministry of Foreign Affairs confirmed that all 20 living captives were back in Israeli territory.

It identified the captives released in the first group as Guy Gilboa-Dalal, 24, Eitan Mor, 25, Matan Angrest, 22, Alon Ohel, 24, Gali and Ziv Berman, both 28, and Omri Miran, 48.

It named the 13 captives freed later as Elkana Bohbot, 36, Rom Braslavski, 21, Nimrod Cohen, 21, Evyatar David, 24, Maxim Herkin, 37, Eitan Horn, 39, Segev Kalfon, 27, Bar Kuperstein, 23, Yosef Chaim Ohana, 25, Avinatan Or, 32, Matan Zangauker, 25 and David and Ariel Cunio, 35 and 28.

Families were reunited with their loved ones before the released captives were flown to hospitals for medical treatment.

Reporting from Amman, Jordan, on the first release, Al Jazeera’s Nour Odeh said the captives were “reported to be in reasonable condition, walking without needing medical assistance”.

Ohel’s parents told The Times of Israel that their son “looks amazing” and is “standing on his own two feet”, while Mor’s mother told Ynet News that her son “looks great, although thin and pale”.

‘The war is over’

While key questions remain over the future of Gaza and Hamas’s role in the territory, the exchange of captives and prisoners has raised hopes for ending Israel’s devastating war, which has ravaged the enclave and killed more than 67,806 people.

The ceasefire is also expected to allow for a surge of humanitarian aid into Gaza, where famine has broken out amid Israel’s bombardment and blockade of the territory. Many of Gaza’s more than two million people are reported to be on the brink of starvation.

Amid the exchange, US President Donald Trump, whose administration played a leading role in putting together the deal, travelled to Israel to address the Knesset ahead of an international summit in Egypt he is due to co-chair later on Monday.

Trump received a rousing reception at the Israeli parliament – but his speech was briefly interrupted when two members of the Knesset staged a protest before being removed. One held up a small sign reading, “Recognize Palestine.”

During his wide-ranging address, Trump declared a “historic dawn of a new Middle East” and paid tribute to leaders from Arab and Muslim nations who he said had come “together to press Hamas, to set the hostages free”.

“We had a lot of help … a lot of people that you wouldn’t suspect, and I want to thank them very much for that,” said Trump, who earlier declared to reporters “the war is over”.

Trump also praised Israeli Prime Minister Benjamin Netanyahu as one of Israel’s “greatest” wartime leaders and, in a detour, urged Israel’s president to pardon the prime minister, who is on trial in three separate corruption cases.

Without addressing Palestinians’ decades-old fight for self-determination and statehood, Trump urged Palestinians to focus on reconstruction, a process he promised to support.

“After tremendous pain and death and hardship,” Trump said, “now is the time to concentrate on building their people up instead of trying to tear Israel down.”

Trump then left Israel for Egypt’s Red Sea resort town of Sharm el-Sheikh, where he is to co-chair the summit alongside Egypt’s President Abdel Fattah el-Sisi.

Dozens of world leaders, including Jordan’s King Abdullah II, Turkish President Recep Tayyip Erdogan, Qatar’s Emir Sheikh Tamin bin Hamad Al Thani and United Nations Secretary-General Antonio Guterres, also travelled to Egypt for the conference.

Netanyahu’s office said the Israeli prime minister will not attend despite being invited by Trump.