Initially, Israel's air strike on the Hamas delegation in Doha appeared like another intensification that drove the hope of a ceasefire further away.
This strike on 9 September violated the territorial integrity of an US partner and risked widening the hostilities into a broader regional conflict.
Negotiations appeared to be collapsing.
However, it proved to be a pivotal event that has led in a deal, declared by Donald Trump, to release all captives still held.
That represents a goal that Trump, and President Joe Biden before him, had pursued for almost 24 months.
It is just the first step towards a more durable peace, and the details of disarming Hamas, administering Gaza and complete Israeli pullout are still to be negotiated.
But if this deal holds, it could be Donald Trump's defining accomplishment of his second term - one that escaped Joe Biden and his administration.
Trump's distinct approach and crucial relationships with the Israeli government and the Middle Eastern nations seem to have played a role in this success.
However, as with many diplomatic achievements, there were also factors at play beyond the control of both leaders.
Publicly, Donald Trump and Benjamin Netanyahu are consistently friendly.
The president likes to say that Israel has no better friend, and the Israeli leader has called him as Israel's "greatest ever ally in the White House". And these warm words have been matched by deeds.
Throughout his initial time in office, the president moved the US embassy in the country from Tel Aviv to the contested capital and discarded a long-held US position that Israeli settlements in the Palestinian West Bank are against international law, the view under international law.
When the Israeli military began its air strikes against Iran in the summer, Trump directed US bombers to strike the Iran's atomic sites with its most powerful conventional bombs.
Those public demonstrations of support may have allowed Trump the room to apply more pressure on Israel behind the scenes. As per sources, the president's envoy, Steve Witkoff, browbeat the prime minister in the latter part of the year into accepting a temporary ceasefire in exchange for the freeing of some hostages.
When Israel launched strikes against Syrian forces in July, even hitting a place of worship, the US president pressured Netanyahu to change course.
The leader exhibited a degree of will and pressure on an Israeli prime minister that is virtually unprecedented, says an analyst of the Carnegie Endowment for International Peace. "It's unheard of of an American president literally telling an Israeli prime minister that they must agree or else."
Joe Biden's relationship with the Israeli administration was always more strained.
The Biden team's "bear hug approach" argued that the United States had to embrace the nation openly in order to enable it to influence the nation's war conduct in private.
Underneath this was the president's nearly half-century of support for the state, as well as sharp divisions within his political base over the conflict in Gaza. Every step the leader took risked dividing his own domestic support, while his successor's loyal conservative voters gave him more flexibility to act.
Ultimately, domestic politics or personal relationships may have had little impact than the simple fact that, during Biden's presidency, the Israeli government was unwilling to reach an agreement.
Eight months into Trump's second term, with Iran weakened, the militant group to its immediate north significantly reduced and the coastal strip in ruins, all its major strategy objectives had been accomplished.
An Israeli strike in Doha, which resulted in the death of a Qatari citizen but not the intended targets, led the president to issue an ultimatum to Netanyahu. The war had to end.
Trump had given the Israeli military a relatively free hand in the territory. He provided US armed support to Israel's campaign in Iran. However an strike on Qatari territory was a different matter entirely, pushing him closer to the stance of Arab nations on how best to end the war.
A number of Trump officials have informed media outlets that this was a turning point which galvanised the president to exert maximum pressure to finalize an agreement.
This US president's strong connections with the Arab monarchies are widely known. Trump has business dealings with Qatar and the United Arab Emirates. He began each of his administrations with official trips to the kingdom. This year, Trump also visited in Qatar and the UAE capital.
The president's Abraham Accords, which normalised relations between the Jewish state and several Muslim states, including the Emirates, was the biggest diplomatic achievement of his first term.
His visits he spent in the cities of the Arabian Peninsula in recent months helped shift his perspective, according to an expert of the Council on Foreign Relations. The US president did not visit Israel on this regional tour but visited the UAE, the kingdom and Qatar where the leader received repeated calls to bring an end to the conflict.
Less than a month after that attack on Doha, the president was present close as the prime minister himself phoned Qatar to apologise. Subsequently, the Israeli leader gave approval on the president's comprehensive proposal for Gaza - one that also had the backing of key Muslim nations in the region.
Assuming the president's alliance with Netanyahu gave him the ability to pressure Israel to reach an agreement, his history with Muslim leaders may have ensured their backing, and assisted them persuade the group to agree to the arrangement.
"A key factor that evidently occurred was that the US leader developed leverage with the Israeli government, and through intermediaries with the militants," notes an analyst of the a research center.
"This was crucial. The capacity to do this on his timing, and not succumb to the demands of the combatants has been a problem that lot of earlier administrations have struggled with, and he appears to do with some success."
The reality that Trump is much more popular in Israel than Netanyahu himself was an advantage that Trump used to his benefit, the expert continues.
Currently the Israeli government has agreed to freeing more than 1,000 Palestinians imprisoned in Israeli prisons and has consented to a limited pullback from Gaza.
The group will release all the captives still held, both alive and deceased, taken during the original 7 October Hamas attack, which resulted in the death of over 1,200 Israelis.
A conclusion to the war, which has resulted in the devastation of the territory and the deaths of over 67,000 {Palestinians|Pal