The Israeli airstrike on the Hamas negotiating team in Qatar acted as another escalation that made peace even more distant.
The September 9 attack violated the sovereignty of an American ally and risked turning the conflict into a regional war.
Diplomacy seemed to be in ruins.
Instead, this attack turned out to be the pivotal moment that ultimately led to the agreement, announced by President Donald Trump, for the release of all remaining hostages.
It was a goal he, and President Joseph Biden before him, had pursued for nearly two years.
This is only the first step towards a more lasting peace, and the details of Hamas's disarmament, rule over Gaza, and Israel's full withdrawal still need to be negotiated.
But if this agreement holds up, it could be Trump's most significant achievement of his second term - one that has continually eluded Biden and his diplomatic team.
Trump's unique style and key relationships with Israel and the Arab world appear to have contributed to this progress.
But, as with all other diplomatic achievements, there were factors at play beyond the control of any of these men.
- What will happen next in Gaza?
- Palestinians return to northern Gaza, ceasefire takes effect, Israel and US say
- Bowen: There is a real chance of ending the war, but it is not over yet
The close relationships Biden never had
In public, Trump and Israeli Prime Minister Benjamin Netanyahu are all smiles when they're together.
Trump likes to say that Israel has no better friend, and Netanyahu has described Trump as "the greatest ally Israel has ever had in the White House."
These warm words were accompanied by corresponding actions.
During his first term as president, Trump moved the US embassy in Israel from Tel Aviv to Jerusalem and abandoned the long-standing US position that Israeli settlements in the Palestinian West Bank are illegal, a position under international law.
When Israel began airstrikes on Iran in June, Trump ordered US bombers to target uranium enrichment facilities with the most powerful conventional bombs.
These public expressions of support may have given Trump the space to put more pressure on Israel behind the scenes.
According to reports, Trump's negotiator Steve Witkoff forced Netanyahu in late 2024 to accept a temporary ceasefire in exchange for the release of some hostages.
When Israel launched airstrikes against Syrian forces in July, which included the bombing of a Christian church, Trump pressured Netanyahu to change course.
Trump was asserting his own will and pressuring the Israeli prime minister in a way that had never been seen before, says Aaron David Miller of the Carnegie Endowment for International Peace.
"You don't have an example before of an American president literally telling an Israeli prime minister that he has to obey him or it won't go well."
Biden's relationship with Netanyahu's government has always been tenuous.
His administration's "bear hug" strategy said that America must embrace Israel in public, which allows it to privately manage the country's warlike behavior.
Underneath all of this was nearly half a century of Biden's support for Israel, as well as sharp divisions within his Democratic coalition over the war in Gaza.
Every move Biden made risked eroding the support he had at home, while a solid Republican base gave Trump more room to maneuver.
In the end, domestic politics or personal relationships may have been less important than the simple fact that, during Biden's tenure, Israel was not ready for peace.
Eight months into Trump's second term, with Iran humiliated, Hezbollah in the north significantly reduced, and Gaza in ruins, all of his major strategic goals had been achieved.
Business history helps gain Gulf support
An Israeli missile attack on Doha, which killed a Qatari citizen and no Hamas officials, prompted Trump to issue an ultimatum to Netanyahu.
The war must stop.
Trump has previously given Israel a relatively free hand in Gaza.
He put American military power at the disposal of Israel's campaign in Iran.
But the attack on Qatari soil was something else entirely, bringing it closer to the Arab position on how best to end the war.
Several Trump officials told the BBC's US partner CBS that it was a turning point that prompted the president to apply maximum pressure to secure a peace deal.
This American president's close ties to the Persian Gulf countries are well documented.
He has business relations with Qatar and the United Arab Emirates.
He began both presidential terms with state visits to Saudi Arabia.
This year he also visited Doha and Abu Dhabi.
His Abraham Accords, which normalized relations between Israel and several Muslim states, including the United Arab Emirates, were the greatest diplomatic achievement of his first term.
His time spent in the capitals of the Arabian Peninsula earlier this year helped him change his mindset, says Ed Hussein of the Council on Foreign Relations.
The US president did not visit Israel on this trip to the Middle East, but he did visit the United Arab Emirates, Saudi Arabia and Qatar, where he heard numerous calls to end the war.
Less than a month after that Israeli attack in Doha, Trump sat next to Netanyahu as the Israeli prime minister phoned Qatar to apologize.
And later that same day, the Israeli leader signed Trump's 20-point Gaza plan – the same one that has won support from key Muslim countries in the region.
If Trump's relationship with Netanyahu provided the space to pressure Israel to reach an agreement, his history with Muslim leaders may have secured their support and helped persuade Hamas to commit to the deal.
"One of the things that has clearly happened is that President Trump has gained influence over the Israelis and indirectly over Hamas," says John Alterman of the Center for Strategic and International Studies (CSIS).
"That's what made the difference. His ability to do it at his own pace, without succumbing to the wishes of opposing parties, has been a problem that many previous presidents have struggled with, and he seems to be doing it relatively successfully."
The fact that Trump is much more popular in Israel than Netanyahu himself was a power he used, he adds.
Now Israel has pledged to release more than 1.000 Palestinians held in Israeli prisons and has agreed to a partial withdrawal from Gaza.
Hamas will release all remaining hostages, both dead and alive, taken during the original attack on October 7, when more than 1.200 Israelis were killed.
An end to the war, which has led to the destruction of Gaza and the deaths of more than 67.000 Palestinians, is now conceivable.
European influence
The world's condemnation of Israel for its actions in Gaza also had an impact on Trump's reasoning.
Conditions on the ground are unprecedented in terms of the level of destruction and humanitarian catastrophe for the Palestinians.
Netanyahu's government has become increasingly isolated in the world in recent months.
When Israel took military control of the Palestinian food supply and then announced a planned attack on Gaza City, several major European countries, led by French President Emmanuel Macron, decided they could no longer stand behind Washington's unconditional support for Israel.
What followed was a historic split between the Americans and their European allies on key elements of diplomacy and the future of the Israeli-Palestinian conflict.
The Trump administration rebuked France when it announced it would recognize a Palestinian state, a move that was soon followed by the United Kingdom.
They attempted to artificially keep the idea of two states alive, but more importantly, to marginalize extremists on both sides and revive the diplomatic path to a shared Israeli-Palestinian future.
But Macron was shrewd in including the Saudis in his own peace plan.
Ultimately, Trump faced a European-Arab alliance against Israeli nationalists and far-right extremists when it came to the long-term vision for Gaza.
He chose friends in the Gulf.
Under the Franco-Saudi peace plan, Arab countries also issued an unprecedented condemnation of Hamas's October 7 attacks and called on the group to end its rule in Gaza and hand over its weapons to the Palestinian Authority under independent statehood.
It was a diplomatic victory for the Arabs and the Europeans.
Trump's 20-point plan leveraged the Franco-Saudi plan in key areas, including a reference to Palestinian "statehood," even if it was vague and highly conditional.
By asking Turkey, Qatar, and Egypt to keep up the pressure on Hamas, Trump has backed Netanyahu into a corner, putting unprecedented pressure on him to end the war.
No one could afford to reject Trump.
Trump's unique style breaks the stalemate
Trump's unorthodox performance can still shock.
It starts off boastful or bombastic, but then develops into something more conventional.
In his first term, his insults like "little rocket man" and warnings like "fire and fury" seemed to bring the US and North Korea to the brink of war.
Instead, he engaged in direct negotiations.
Trump began his second term with a shocking proposal to move Palestinians from Gaza and turn it into an international coastal resort.
Muslim leaders were furious.
Experienced Middle Eastern diplomats were terrified.
Trump's 20-point plan, however, is not that different from the kind of deal Biden would make and that American allies have long supported.
It is certainly not a blueprint for the Gaza Riviera.
Trump took a very unconventional route to a very conventional result.
It was chaotic along the way.
This may not be how they teach you diplomacy at top universities.
But, at least in this case and at this moment, it has proven effective.
Today, the Nobel Committee announced this year's winner of the Peace Prize.
And although the chances of Trump winning were slim, the possibility didn't seem nearly as unlikely as it did just a few weeks ago.
Additional reporting: Kayla Epstein
BBC is in Serbian from now on and on YouTube, follow us HERE.
Follow us on Facebook, Twitter, Instagram, YouTube i Viber. If you have a topic suggestion for us, please contact bbcnasrpskom@bbc.co.uk
- Trump's Gaza plan: What are the essential obstacles?
- Israeli government approves Gaza ceasefire deal with Hamas
- Gaza after the war: Who will deal with the 'security nightmare'?
Bonus video: