At first, Israel's air strike on the Hamas militant negotiating team in Doha appeared like yet another intensification that pushed the prospect of a ceasefire out of reach.
The attack on 9 September breached the sovereignty of an American ally and risked widening the hostilities into a broader regional conflict.
Diplomacy seemed to be collapsing.
However, it proved to be a pivotal event that culminated in a agreement, declared by Donald Trump, to release all remaining hostages.
This is a objective that he, and Joe Biden before him, had sought for nearly two years.
It is just the initial phase towards a more durable peace, and the details of disarming Hamas, Gaza governance and complete Israeli pullout remain to be worked out.
Yet if this deal holds, it could be Donald Trump's defining accomplishment of his return to office - one that escaped Joe Biden and his administration.
Trump's unique style and crucial relationships with Israel and the Middle Eastern nations appear to have contributed in this breakthrough.
But, as with most foreign policy wins, there were also factors at play beyond the influence of either man.
In public, Trump and Israeli Prime Minister Benjamin Netanyahu are all smiles.
The president likes to say that Israel has no greater ally, and Netanyahu has described Trump as Israel's "greatest ever ally in the White House". And these warm words have been backed up by actions.
During his first presidential term, the president moved the American diplomatic mission in the country from its former location to Jerusalem and discarded a traditional American stance that Jewish communities in the Palestinian West Bank are illegal, the position under global norms.
When Israel began its bombing campaign against Iran in the summer, the US leader ordered US bombers to strike the nation's nuclear enrichment facilities with its largest non-nuclear weapons.
These visible shows of backing may have given Trump the leeway to exert more pressure on the Israeli government behind the scenes. As per sources, the president's negotiator, his representative, pressured the prime minister in the latter part of the year into accepting a temporary ceasefire in return for the freeing of a number of captives.
After Israel attacked against Syrian forces in the summer, including hitting a Christian church, the US president urged Netanyahu to alter tactics.
Trump exhibited a level of determination and pressure on an Israeli prime minister that is virtually unprecedented, according to an analyst of the a think tank. "It's unheard of of an American president literally telling an Israeli leader that they must agree or else."
Biden's relationship with Netanyahu's government was consistently more strained.
His administration's "close embrace approach" argued that the US had to embrace Israel openly in order to enable it to moderate the country's military actions behind closed doors.
Underneath this was the president's nearly half-century of backing for Israel, as well as deep disagreements within his political base over the conflict in Gaza. Every step the leader took risked dividing his own political backing, whereas Trump's loyal conservative voters provided him more flexibility to act.
In the end, internal considerations or personal relationships may have had less importance than the simple fact 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, the militant group to its immediate north greatly diminished and the coastal strip in ruins, all its major strategy objectives had been achieved.
An Israeli strike in Doha, which killed a Qatari citizen but no Hamas officials, prompted the president to deliver an final demand to the prime minister. The war had to stop.
Trump had given the Israeli military a relatively free hand in the territory. He lent US armed support to Israeli operations in the neighboring country. But an strike on Qatar soil was a different matter entirely, moving him towards the stance of Arab nations on how best to conclude the conflict.
A number of administration figures have informed media outlets that this was a turning point which galvanised the leader to apply full force to get a peace deal done.
The leader's strong connections with the Gulf states are widely known. He has business dealings with the emirate and the UAE. He began each of his administrations with state visits to the kingdom. Recently, he also visited in Qatar and Abu Dhabi.
His normalization agreements, which normalised relations between Israel and a number of Arab nations, including the Emirates, was the most significant diplomatic achievement of his first term.
His visits he spent in the cities of the Gulf region earlier this year contributed to change his thinking, says an expert of the Council on Foreign Relations. Trump did not visit Israel on this Middle East trip but visited the UAE, the kingdom and the state where the leader heard repeated calls to put a stop to the conflict.
Within weeks after that Israeli strike on the city, the president was present nearby as the prime minister himself phoned the Qatari leadership to apologise. And later that day, the Israeli leader gave approval on Trump's 20-point peace plan for Gaza - one that additionally had the backing of influential Arab states in the region.
Assuming the president's relationship with his counterpart provided him the room to influence Israel to reach an agreement, his history with Muslim leaders may have secured their backing, and helped them persuade the group to commit to the arrangement.
"A key factor that evidently occurred was that President Trump gained influence with the Israelis, and indirectly with Hamas," notes an analyst of the Center for Strategic and International Studies.
"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 faced, and he appears to handle relatively successfully."
The reality that the president is much more popular in Israel than Netanyahu personally was an advantage that he used to his benefit, he adds.
Now the Israeli government has agreed to freeing more than 1,000 detainees held in Israeli prisons and has agreed to a limited pullback from the strip.
The group will release all the remaining hostages, living and dead, taken in the original 7 October Hamas attack, which caused the death of more than 1,200 Israeli citizens.
An end to the conflict, which has led to the devastation of Gaza and the deaths of more than 67,000 {Palestinians|Pal