GAZA/JERUSALEM, Nov 26 (Reuters) - Thirteen Israelis and four Thai nationals arrived in Israel on Sunday in the second release of hostages from Hamas captivity in exchange for Palestinian prisoners in a deal briefly endangered by a dispute about aid delivery into Gaza.

Although overcome by the mediation of Egypt and Qatar, the dispute that threatened the truce to free captives underscored the fragility of the pact meant to release 50 hostages held by the Palestinian militant groups and 150 prisoners held in Israeli jails over four days.

Television images showed hostages on the Egyptian side of the Rafah border crossing after leaving Gaza, as Hamas handed the captives to the International Committee of the Red Cross late on Saturday.

Six of the 13 Israelis released were women and seven were children and teenagers.

"The released hostages are on their way to hospitals in Israel, where they will re-unite with their families," the Israel Defense Forces (IDF) said in a statement.

Israel released 39 Palestinians - six women and 33 minors - from two prisons, the Palestinian news agency WAFA said.

Some of the Palestinians arrived at Al-Bireh Municipality Square in Ramallah in the Israeli-occupied West Bank, where thousands of citizens awaited them, a Reuters witness said.

A Palestinian official familiar with the diplomatic moves said Hamas would continue the truce, the first halt in fighting since Hamas fighters rampaged through southern Israel on Oct. 7, killing 1,200 people and taking about 240 hostages.

In response to that attack, Israel has vowed to destroy the Hamas militants who run Gaza, raining bombs and shells on the enclave and launching a ground offensive in the north. Some 14,800 people, roughly 40% of them children, have been killed, Palestinian health authorities said on Saturday.

Saturday's swap follows the previous day's initial release of 13 Israeli hostages, including children and the elderly, by Hamas in return for the release of 39 Palestinian women and young people from Israeli prisons.

On Friday Hamas also released a Philippine national and 10 Thai farm workers.

The four Thais released on Saturday "want a shower and to contact their relatives", Prime Minister Srettha Thavisin said a day later on social media platform X, adding that all were safe and showed few ill-effects.

Eighteen Thais remain captive, Thailand's foreign ministry said on Sunday.

Photo from AFP