Initially, the Israeli aerial attack on the Hamas militant delegation in Qatar seemed like another escalation that drove the hope of peace out of reach.
This strike on 9 September breached the sovereignty of an US partner and threatened expanding the conflict into a broader regional conflict.
Negotiations appeared to be in ruins.
Instead, it turned out to be a key moment that has led in a deal, announced by President Donald Trump, to release all remaining hostages.
That represents a objective that Trump, and President Joe Biden before him, had sought for almost 24 months.
This marks just the first step towards a lasting resolution, and the specifics of Hamas disarmament, Gaza governance and complete Israeli pullout remain to be worked out.
Yet if this agreement stands, it could be Donald Trump's signature achievement of his return to office - one that escaped Biden and his diplomatic team.
The president's unique style and crucial relationships with Israel and the Middle Eastern nations seem to have played a role in this breakthrough.
However, as with most foreign policy wins, there were also factors involved beyond the influence of either man.
A Close Relationship Which Biden Never Had
Publicly, Trump and Benjamin Netanyahu are all smiles.
Trump likes to say that Israel has no better friend, and Netanyahu has called him as the country's "greatest ever ally in the US presidency". Moreover these positive statements have been matched by actions.
Throughout his first presidential term, the president relocated the US embassy in the country from its former location to Jerusalem and discarded a traditional American stance that Israeli settlements in the Palestinian West Bank are illegal, the position under international law.
After Israel began its bombing campaign against Iran in the summer, Trump ordered US bombers to target the Iran's atomic sites with its largest non-nuclear weapons.
These public demonstrations of backing may have allowed the president the room to exert more pressure on the Israeli government 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 halt in fighting in exchange for the release of a number of captives.
When Israeli forces attacked against Syrian forces in July, even hitting a place of worship, Trump pressured Netanyahu to alter tactics.
The leader exhibited a level of will and insistence on an Israel's leader that is rarely seen, according to Aaron David Miller of the a think tank. "There is no example 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 consistently more tenuous.
His administration's "close embrace strategy" argued that the US had to embrace Israel publicly in order to enable it to influence the country's military actions in private.
Beneath this was Biden's decades-long of backing for the state, as well as deep disagreements within his Democratic coalition over the Gaza War. Each move the leader took risked dividing his own domestic support, whereas his successor's loyal conservative voters gave him more flexibility to manoeuvre.
In the end, internal considerations or personal relationships may have had less importance than the reality that, throughout his term, the Israeli government was not ready to reach an agreement.
Several months into Trump's second term, with the Islamic Republic weakened, Hezbollah to its immediate north significantly reduced and the coastal strip in ruins, all its major strategy objectives had been accomplished.
Commercial Background Helped Secure Support from Arab States
The Israeli missile attack in Doha, which killed a local national but no Hamas officials, prompted the president to issue an final demand to Netanyahu. Hostilities had to end.
The US leader had given the Israeli military a relatively free hand in the territory. He provided American military might to Israeli operations in Iran. But an strike on Qatar soil was a different matter completely, pushing him towards the stance of Arab nations on how best to conclude the conflict.
A number of Trump officials have told media outlets that this was a decisive moment which motivated the leader to exert full force to finalize an agreement.
This US president's close ties with the Arab monarchies are widely known. He has commercial interests with Qatar and the UAE. He began both his presidential terms with official trips to Saudi Arabia. This year, Trump also stopped in Qatar and the UAE capital.
His Abraham Accords, which normalised relations between the Jewish state and several Muslim states, including the UAE, was the biggest diplomatic achievement of his first term.
The time devoted in the capitals of the Arabian Peninsula earlier this year contributed to change his thinking, says Ed Husain of the a policy institute. Trump did not travel to Israel on this Middle East trip but visited the United Arab Emirates, the kingdom and the state where the leader received consistent appeals to put a stop to the conflict.
Within weeks after that attack on Doha, the president was present close as the prime minister himself called the Qatari leadership to express regret. And later that day, 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 area.
Assuming Trump's relationship with his counterpart provided him the room to influence Israel to strike a deal, his past with Muslim leaders may have ensured their backing, and helped them persuade the group to agree to the arrangement.
"One of the things that evidently occurred was that President Trump developed influence with the Israeli government, and through intermediaries with Hamas," says Jon Alterman of the a research center.
"This was crucial. The capacity to do this on his own schedule, and not succumb to the demands of the warring sides has been a problem that lot of previous presidents have struggled with, and he seems to do with some success."
The reality that the president is much more popular in Israel than Netanyahu personally was an advantage that Trump used to his advantage, he adds.
Now the Israeli government has committed to freeing more than 1,000 detainees held in Israeli prisons and has agreed to a limited pullback from the strip.
Hamas will free all the remaining hostages, living and dead, captured during the original 7 October Hamas attack, which caused the loss of over 1,200 Israelis.
A conclusion to the war, which has resulted in the destruction of the territory and the deaths of over 67,000 {Palestinians|Pal