A third group of Gaza Strip hostages, including a 4-year-old American girl whose parents were killed in the Hamas raids on Israel, was freed on Sunday, raising the prospect more captives could be set free and a fragile truce extended.

The 17 hostages released by Hamas, who were seized when the militants raided Israel on Oct. 7, included three Thai citizens, one Russian and the little girl Avigail Idan, a dual American-Israeli citizen who was kidnapped from a kibbutz. She marked her fourth birthday in captivity in Gaza on Friday.

“Thank God she’s home,” President Biden said to reporters in Nantucket, Mass., where he spent the Thanksgiving holiday. “I wish I was there to hold her.”

Much hinged on the latest release of hostages, who were exchanged for 39 Palestinian prisoners held by Israel on the third day of a four-day truce.

With both Israel and Hamas poised to resume fighting at a moment’s notice, a collapse of the agreement might have quickly led to a resumption of the hostilities that have already killed thousands of people. It might also have choked off the desperately needed supplies that have only just started making their way to civilians in Gaza.

Instead, late Sunday, responding to an offer by Israel to add one day to the cease-fire for every 10 hostages released, Hamas said it, too, was interested in extending the agreement. Nevertheless, visiting Israeli troops in Gaza on Sunday, Prime Minister Benjamin Netanyahu vowed that “we are continuing until the end — until victory.”

Later, in a video statement issued soon after Hamas suggested extending the truce, Mr. Netanyahu said he would welcome that.

Just a day earlier, as a second round of hostage releases was nearing, 11th-hour complications prompted speculation that the deal might be dead.

Hamas and its allies seized an estimated 240 hostages when they attacked southern Israel last month, killing about 1,200 people, most of them civilians. In Israel’s responding air and ground attacks on Gaza, which is controlled by Hamas, more than 13,000 people have been reported killed.

On Friday, after protracted negotiations involving Qatar and the United States, Israel and Hamas paused the fighting for four days to allow the hostages to be released and food and other supplies to enter devastated Gaza neighborhoods.

Under the initial terms of the deal, Israel and Hamas agreed to a truce to allow for the exchange of 50 hostages held by Hamas and 150 Palestinian women and youths in Israel jails.

For residents of Gaza, struggling to find food, water, fuel and medical care, the deal offered hope that basic supplies would again be allowed across borders blockaded by Israel and Egypt.

On Sunday, the Egyptian government said that 200 aid trucks had entered Gaza the previous day, including seven trucks carrying 129,000 liters of diesel fuel. It said later that as of Sunday afternoon, 120 more trucks had entered, including two carrying fuel and two with cooking gas, and that the number was expected to increase in the coming hours.

The information that has trickled out of northern Gaza points to a grim struggle for survival.

The United Nations Office for the Coordination of Humanitarian Affairs for Gaza and the West Bank reports that people in northern Gaza have been eating unripe fruit and the few raw vegetables remaining, and that they cannot find bread. Livestock has been dying for lack of feed, and crops are being increasingly abandoned for lack of fuel to pump irrigation water, the office said.

In scattered interviews before the truce took hold, people in Gaza said they were burning cardboard to cook what little food they had left and filtering nonpotable water through clothing in an attempt to clean it.

Mr. Biden said the goal now was to build on the cease-fire.

“More is needed, but this deal is delivering lifesaving results,” he said. “Critical aid is going in, and hostages are coming out. This deal is structured so that it can be extended to keep building on these results. That’s my goal, that’s our goal, to keep this pause going beyond tomorrow.”

In his visit to Israeli troops on Sunday, Mr. Netanyahu said, “We are making every effort to bring back our hostages, and eventually we will return them all.”

Television images showed people lining the road outside an air base in southern Israel, waving flags and cheering as the convoy of minibuses carrying 12 of the freed hostages made its way inside.

Their freedom came as accounts began to emerge from hostages released last week.

The freed hostages have not spoken directly to the news media. Most are still being treated in private areas of Israeli hospitals, and much of the information about where, and how, they were held remains classified.

But relatives who have spoken with them said all seemed to have spent their weeks in captivity totally cut off from the outside world, and to have returned thinner than before.

“They were eating, but not regularly and not all of the time,” said Merav Mor Raviv, a cousin of Keren Munder, 54, who was released on Friday along with her son, Ohad Munder-Zichri, 9, and her mother, Ruth Munder, 78.

“They ate a lot of rice and bread,” Ms. Raviv said.

Ruth Munder learned only after being freed that her son Roi had been killed on Oct. 7, Ms. Raviv said. But she also learned that her husband, Avraham Munder, whom she had believed dead, was still alive, though captive in Gaza.

Rear Adm. Daniel Hagari, the chief spokesman of the Israeli military, said another hostage, Elma Avraham, was flown by army helicopter directly from Gaza to an Israeli hospital in serious condition. The Israeli military said four others — one Israeli and three foreign citizens — had crossed into Egypt.

Within hours of the hostages’ release on Sunday, Israel’s prison service said it had released 39 Palestinians in its custody.

In the Israeli-occupied West Bank, Ziad Dawoud, 53, had been awaiting word on whether his 17-year-old son, Tariq, would be among those freed. The young man was accused almost a year ago of throwing stones at Israeli soldiers.

When he learned that his son was being released, he said, Mr. Dawoud raced from their hometown, Qalqiliya, to Ramallah, where hundreds had gathered outside the Ofer prison. After his son stepped off the bus of freed prisoners, he said, the two hugged and the younger Dawoud went to kiss his father’s feet in a sign of respect.

His father refused to let him.

“I told him: ‘Oh my son, my love,’” Mr. Dawoud said.

The prisoner exchanges elated family members far from Israel and the Palestinian territories.

Three of the hostages released on Sunday are Thais who had been working in Israel when the Hamas combatants crossed the border. Among them was Anucha Angkaew, who appeared in a photograph that circulated on social media showing him with three other men being held at gunpoint, hands behind their backs.

His mother, Watsana Yojampa, said Sunday that Thai officials had confirmed that he was now free.

“I’m so glad, so delighted, that no words can explain,” Ms. Watsana said.

Anna Betts, Peter Baker, Nadav Gavrielov, Lisa Friedman, Christina Goldbaum, Hiba Yazbek and Yara Bayoumy contributed reporting.