Israeli Prime Minister Benjamin Netanyahu grabbed Brett McGurk’s arm as he walked out of a tense meeting of the Israeli Cabinet over securing the release of hostages Hamas was holding in Gaza. “We need this deal,” Netanyahu told the White House Middle East coordinator a week ago in Tel Aviv, according to sources familiar with the exchange. Earlier that day, Netanyahu and President Joe Biden had agreed over the phone that they were ready to accept the broad contours of a deal for Hamas to release 50 women and children who were being held hostage. A major breakthrough had come two days earlier on November 12. Hamas – after refusing for days – had relented in offering identifying information about several dozen hostages, such as their age, gender and nationalities. The information confirmed that numerous children and toddlers had been taken captive on October 7. Even though Israel and the US believed there were more than 50 women and children hostages, both sides agreed that they needed to move ahead with securing the release of those 50 – and hope that the deal might incentivize Hamas to release more after the initial group. Hamas goes dark But hours after McGurk’s meeting with Netanyahu, everything went dark. The Qataris – who had been playing the main mediating role – couldn’t get a hold of Hamas. When the group finally resurfaced, Hamas threatened to derail the talks: It demanded that the Israel Defense Forces, which had gone in to raid Al-Shifa hospital, leave the hospital grounds. IDF declined but indicated that it would keep the hospital running. Once the talks resumed, Biden – who was in San Francisco having just finished a summit with Chinese President Xi Jinping – placed one more call to the emir of Qatar. His message: Time was up. The emir gave Biden his assurances that he would do everything possible to close the deal. The next day, McGurk met in person with the emir in Doha to examine the text of the final deal that by this point was around half a dozen pages long. It laid out how women and children would leave in the first phase, as well as incentives for Hamas to release more hostages beyond that. CIA Director Bill Burns was dialed in to the meeting by phone. Israel’s war cabinet approved the deal after making minor changes on Sunday, and the text of the agreement was passed on to Hamas for the last time by the emir of Qatar. The emir made clear: This is the final offer. On Tuesday morning, Hamas responded to their Qatari interlocutors: They approved the deal. A ‘pilot’ negotiation While efforts to negotiate a deal began in the immediate days after Hamas attacked Israel on October 7, the groundwork for the deal started coming together weeks later, after the Biden administration had confidence that communication with Hamas via the Qataris was effective. Officials would later describe this as their “pilot” negotiation. On October 23, the White House had successfully secured the release of two American citizens from Gaza – Natalie and Judith Raanan. As the mother and daughter made their way across Gaza, national security adviser Jake Sullivan, principal deputy national security adviser Jon Finer and McGurk were huddled in Sullivan’s office, tracking the Raanans’ movements in real time. Sources described their multi-hour journey as “excruciating.” When the women arrived at the border, Charge d’Affaires Stephanie Hallett was waiting for them. At this point, Biden placed a call to Natalie Raanan’s father to share the joyful news, and later in the day, he would speak with both women. That day would serve as proof to Biden’s top national security officials that the White House had successfully established a means of communicating and negotiating with Hamas via Qatar. And it triggered what would ultimately become the weeks-long effort to secure the release of a larger group of hostages. Foundations of a deal After the Israelis delegated the director of Mossad to negotiate on the hostages, back in the US, Burns, too, became intimately involved. In Doha, Qatari Prime Minister Mohammed bin Abdulrahman Al Thani engaged directly with senior Hamas political leader Ismail Haniyeh, a person familiar with the discussions said. In multiple phone calls in October, Biden impressed upon Netanyahu that there was a path for a large group of hostages to be released. On October 24, Hamas appeared to agree to the parameters of a deal to release women and children hostages. American and Israeli officials furiously deliberated whether Israel should delay its ground invasion. Ultimately, Israel wasn’t convinced. At this point, they still had no proof of life of any of the hostages that Hamas claimed to have, and they also didn’t buy Hamas’ claim that they couldn’t determine the identities of the hostages until there was a pause in fighting. Israel began its ground invasion on October 27. In the weeks that followed, the US, Israel and Qatar went back and forth with Hamas, negotiating with the group about every detail of a possible deal: the timeframe, number of hostages, safe passage corridors and surveillance. Blinken returned to Israel in early November to press the Israeli government to accept “humanitarian pauses,” something that the US argued would advance progress on the hostages. Although there was an agreement in principle after Blinken met with Netanyahu and the war cabinet, the Israeli prime minister publicly rejected the idea just hours after that meeting. It took days of pressure from the US for the Israeli government to institute and acknowledge “tactical pauses.” The talks at times seemed to move painfully slow, as each step of the communication moved from Doha, Qatar, or Cairo to Hamas in Gaza, then back again, before being relayed to Israel and the US. “Every step of this is like pulling teeth,” one official said at the time. Behind the scenes, the hostages were the key issue that prevented Israel from initially agreeing to a humanitarian pause, because the Israeli government did not want to signal any kind of relief in exchange for hostages, a senior State Department official said. Numerous different permutations of a deal were discussed. Israeli and US officials initially insisted that all women and children come out in the first part of the release. Hamas would only guarantee 50 and refused to produce identifying information about the hostages. By the time that Burns met in Doha with the emir of Qatar and David Barnea, the director of the Mossad, the fact that there was no identifying information about the hostages was a major sticking point. On November 12, Biden informed the emir of Qatar that the negotiation could not move forward without this information in what a senior administration official described as a “very important and very intense call.” Shortly after, Hamas finally relented, seemingly guaranteeing that any final deal would entail the release of 50 women and children hostages. Next steps While the deal reached this week only returns 50 women and children, US officials projected confidence Tuesday that the agreement will ultimately pave the way for additional hostage releases. There are 10 Americans who remain unaccounted for, including two women and a 3-year-old girl. Pressed by CNN on the remaining Americans, a senior administration official said the White House remains “determined to get everybody home,” and suggested that the deal is structured to “very much (incentivize) the release of everybody.” An agreement to release hostages from Hamas would “unlock the potential for delivery of more humanitarian assistance” into Gaza, State Department spokesperson Matt Miller said Tuesday. After their safe passage, the released hostages will be given medical attention in Israel, National Security Council spokesman John Kirby told reporters, suggesting that some could have longer-term medical needs following six weeks in “abhorrent conditions.” Then there will be efforts to repatriate citizens to their home countries and connect them with their families. For any American citizens released, Kirby said, after medical care is prioritized, the US State Department will provide consular assistance. It could be 24 to 48 hours before the Biden administration has confirmation as to whether the two American women and orphaned American 3-year-old were among those released, one US official said. CNN’s Alex Marquardt contributed to this report.