At first, Israel's aerial attack on the Hamas militant negotiating team in Qatar seemed like another escalation that pushed the prospect of a ceasefire further away.
The attack on September 9 breached the territorial integrity of an American ally and risked expanding the conflict into a broader regional conflict.
Diplomacy appeared to be in ruins.
Instead, it turned out to be a key moment that culminated in a agreement, declared by Donald Trump, to free all captives still held.
That represents a objective that he, and President Joe Biden previously, had pursued for almost 24 months.
This marks just the initial phase towards a lasting resolution, and the specifics of disarming Hamas, Gaza governance and complete Israeli pullout remain to be worked out.
Yet if this agreement holds, it could be Donald Trump's defining accomplishment of his second term - one that escaped Biden and his administration.
Trump's distinct approach and crucial relationships with Israel and the Middle Eastern nations seem to have played a role in this success.
But, as with many diplomatic achievements, there were also elements involved beyond the influence of both leaders.
In public, Donald Trump and Benjamin Netanyahu are consistently friendly.
Trump likes to say that the nation has no better friend, and the Israeli leader has described Trump as Israel's "most supportive friend in the US presidency". And these positive statements have been backed up by actions.
During his first presidential term, the president moved the American diplomatic mission in Israel from Tel Aviv to Jerusalem and discarded a traditional American stance that Jewish communities in the Palestinian West Bank are illegal, the view under global norms.
When the Israeli military began its bombing campaign against Iran in the summer, Trump directed US bombers to strike the Iran's atomic sites with its most powerful conventional bombs.
These visible shows of support may have given Trump the room to apply more pressure on Israel behind the scenes. According to reports, Trump's envoy, Steve Witkoff, browbeat the prime minister in late 2024 into accepting a temporary ceasefire in exchange for the release of some hostages.
After Israeli forces attacked against Syrian forces in the summer, including bombing a Christian church, the US president pressured Netanyahu to alter tactics.
Trump exhibited a degree of will and insistence on an Israeli prime minister that is rarely seen, says an analyst of the a think tank. "It's unheard of of an American president directly instructing an Israeli leader that you're going to have to comply or else."
Biden's connection with the Israeli administration was consistently more strained.
The Biden team's "close embrace strategy" argued that the US had to support Israel publicly in order to enable it to influence the country's war conduct in private.
Beneath this was Biden's decades-long of backing for the state, as well as sharp divisions within his political base over the conflict in Gaza. Each move Biden took endangered fracturing his own domestic support, whereas his successor's loyal conservative voters gave him more flexibility to act.
In the end, internal considerations or personal relationships may have had little impact than the reality that, during Biden's presidency, Israel was not ready to make peace.
Several months into his new administration, with Iran weakened, Hezbollah to its northern border significantly reduced and Gaza devastated, all its key military goals had been accomplished.
An Israeli strike in Doha, which killed a local national but not the intended targets, led Trump to issue an final demand to Netanyahu. The war had to end.
The US leader had allowed the Israeli military a significant latitude in Gaza. He provided US armed support to Israeli operations in Iran. But an strike on Qatar soil was a different matter entirely, pushing him towards the stance of Arab nations on how best to end the war.
A number of Trump officials have told media outlets that this was a turning point which motivated the leader to exert maximum pressure to get a peace deal done.
The leader's close ties with the Arab monarchies are widely known. Trump has commercial interests with the emirate and the UAE. He began both his presidential terms with state visits to Saudi Arabia. This year, he also stopped in Doha and Abu Dhabi.
The president's normalization agreements, which established ties between Israel and a number of Arab nations, such as the Emirates, was the biggest diplomatic achievement of his initial presidency.
His visits he spent in the cities of the Gulf region earlier this year helped shift his perspective, says an expert of the a policy institute. Trump did not visit the country on this regional tour but visited the United Arab Emirates, the kingdom and Qatar where the leader heard consistent appeals to put a stop to the war.
Less than a month after that attack on the city, Trump sat close as Netanyahu personally called Qatar to apologise. And later that day, the prime minister gave approval on Trump's 20-point peace plan for the territory - one that additionally had the backing of key Muslim nations in the area.
Assuming the president's alliance with Netanyahu provided him the ability to influence Israel to reach an agreement, his past with Muslim leaders may have secured their backing, and assisted them convince Hamas to agree to the arrangement.
"A key factor that evidently occurred was that President Trump gained leverage with the Israeli government, and through intermediaries with Hamas," notes an analyst of the a research center.
"This was crucial. The capacity to do this on his timing, and not succumb to the desires of the combatants has been a problem that lot of earlier administrations have struggled with, and he seems to do relatively successfully."
The fact that Trump is far better liked in the nation than the prime minister personally was an advantage that Trump used to his advantage, he adds.
Now the Israeli government has agreed to freeing over a thousand detainees imprisoned in its jails and has consented to a partial withdrawal from the strip.
Hamas will release all the remaining hostages, both alive and deceased, captured in the initial October 7 Hamas attack, which resulted in the loss of more than 1,200 Israeli citizens.
An end to the war, which has resulted in the devastation of the territory and the deaths of more than 67,000 {Palestinians|Pal