As Israel mourned in the wake of the October 7 massacre of more than 1,400 citizens by Hamas terrorists, U.S. President Joe Biden traveled to Tel Aviv to pledge American support. But at an appearance alongside Israeli Prime Minister Benjamin Netanyahu, Biden also struck a note of caution. After the 9/11 attacks, he recalled, “we were enraged in the United States. And while we sought justice and got justice, we also made mistakes.”

In the past three weeks, Biden has hardly been alone in analogizing October 7 and September 11, and in suggesting that Israel might benefit from studying the American experience. But in drawing the analogy, much of this commentary has referred to the entire U.S. “war on terror,” leading to an unwieldy comparison of an acute crisis in Israel to a decades-long period in American national security policy. What Israel is facing right now bears a closer resemblance to the specific challenge that Washington faced in the immediate aftermath of the 9/11 attacks, when the most pressing task was to figure out what to do about al Qaeda’s safe haven in Afghanistan. This more limited analogy is still imperfect, but it is a better fit—and a more analytically useful one.

Over the past 15 months, we have been investigating the core assumptions that underpinned the U.S. effort in Afghanistan, with a particular focus on the decisions made by the George W. Bush administration in the initial weeks and months after the trauma of 9/11. Although there are key differences between the events of 2001 and those of October 7—and even larger differences between a global superpower and a country of nine million surrounded by enemies—the U.S. experience in the early stages of its response to 9/11 offers lessons that could be helpful to Israel today. One is the importance of planning and of setting realistic goals—don’t bite off more than you can chew. Another is the need to know one’s own strengths and core competencies, and to recognize when it might be advantageous to rely on others. Finally, for a country in Israel’s position, it is crucial for leaders to think strategically about who can assist them in achieving their goals—and about who their enemies are and what they fear and desire.

NOT THE SAME, BUT SIMILAR

There are clear differences between the situation that faced the United States after the 9/11 attacks and the one facing Israel now. In the wake of 9/11, U.S. President George W. Bush compared jihadi terrorism to Nazism and communism, and described it as an existential threat to the United States and the democratic world. But that was rhetorical hyperbole. Hamas poses a far graver danger to Israel than al Qaeda ever did to the United States. For 30 years, Hamas has made clear its intention to wipe Israel off the map, and on October 7 it demonstrated that it can carry out mass murder on an intolerable and previously unimaginable scale.

After 9/11, the United States declared a “global war on terror,” broadening its response to include states that gave safe haven to terrorists. This language was used to justify a full-scale U.S.-led war against the Afghan Taliban, which, though it harbored al Qaeda, had no direct involvement in or, by most accounts, any advance knowledge of the 9/11 attacks. Israel, on the other hand, has made clear that its sole enemy is Hamas.

The first phase of the U.S. mission in Afghanistan relied on an Afghan proxy army, the Northern Alliance, with U.S. forces fighting mostly from the air. Israel does not have that luxury. It will need to send ground troops into harm’s way, in a densely populated urban environment where it will be difficult to tell the difference between the enemy and innocent civilians.

Finally, it is often forgotten that initially the U.S. war in Afghanistan met with extraordinary tactical success. In just two months, al Qaeda was deprived of a safe haven and the Taliban were swept from power. It is hard to imagine that Israel will be so lucky.

STAY FOCUSED

Those differences, however, hardly moot the analogy. Like the United States after 9/11, Israel experienced a wrenching national trauma on 10/7 that overthrew its national security assumptions and demanded an immediate and overwhelming response.

The war in Afghanistan began less than a month after 9/11, and the Bush administration took little time to think through what would replace the Taliban government. Indeed, American officials were surprised at how quickly U.S. and Northern Alliance forces defeated the Taliban. They were not alone. Al Qaeda’s leader, Osama bin Laden, had hoped for a U.S. intervention in Afghanistan, believing that American forces would get bogged down in a protracted conflict. But after Taliban fighters threw down their weapons, and the remnants of al Qaeda were surrounded by U.S. forces and their Northern Alliance partners in a cave complex at Tora Bora, bin Laden apologized to his followers for leading them to the brink of ruin.

But Israeli leaders should take note that, after the initial U.S. success in Afghanistan in 2001, Washington blew it. The subsequent American decision to invade Iraq made little strategic sense, alienated key allies including France and Germany, and ensured that postconflict reconstruction in Afghanistan received less attention and fewer resources than it required. Although U.S. officials said that they prioritized the creation of a stable and secure Afghanistan, they lacked the competence and resources to achieve that goal. Even in an ideal world, the United States would have struggled to conduct effective nation building in Afghanistan. But with attention diverted to Iraq, that task became impossible.

Israel should learn from that U.S. overreach and avoid any impulse to engage militarily with Iran or Hezbollah in Lebanon. Israel must narrow its focus to Gaza and prioritize minimizing the military threat from Hamas. Eliminating Hamas’s military and political leadership and destroying the group’s arms caches and tunnel network are discrete and potentially achievable tasks. Anything beyond that could turn the situation into a quagmire that sucks Israel into a drawn-out conflict with no end in sight.

In Afghanistan, the U.S. military’s can-do attitude informed a belief that American troops could win not only the war but also the peace. That task, however, was far outside the core competence of the U.S. military—and even that of civilian agencies such as the State Department and USAID. The U.S. presence on the ground in Afghanistan, although well intentioned, often inspired terrorist attacks and military reprisals in which innocent Afghans were caught in the crossfire.

Like its American counterpart, the Israeli military is an effective fighting force and has the weaponry and technology it needs to deal its foes a grievous blow. But its army is not equipped, either culturally or tactically, to handle a long-term military occupation of the Gaza Strip. Israel thus needs a clear-eyed view of its strengths and an understanding of which of its allies it can rely on for support. The United States will be crucial, but so, too, will be the Arab states with which Israel has signed peace agreements or normalization accords. Israel must also consider how to work with the United Nations and the Palestinian Authority (PA), led by President Mahmoud Abbas. Most Israelis distrust the UN because its perceived anti-Israel bias. It is, however, perhaps the only global organization with the knowledge and credibility to lead an effective postconflict stabilization effort in Gaza. No plan for “the day after” in Gaza can exclude it.

KNOW YOUR ENEMY

One of the main weaknesses of the U.S. war in Afghanistan was an inability to focus narrowly on the main enemy. By stating early on that there was no difference between terrorists and the countries that sheltered them, Washington ensured that the Taliban would be treated little differently than al Qaeda—even though there was minimal common ground between these two groups. Indeed, in the years before 9/11, the Taliban and al Qaeda leaderships viewed each other warily. Whereas the latter was focused on international jihad, the Taliban actively sought international recognition, legitimacy, and, ultimately, assistance. At various points in the late 1990s, the Taliban’s leader, Mullah Omar, seriously considered banishing bin Laden from Afghanistan, a move that many of his lieutenants supported.

By December 2001, two months after the war began, the Taliban had given up. Those around Mullah Omar told him they intended to surrender to the country’s new president, Hamid Karzai—and repeatedly tried to do so. Whereas al Qaeda terrorists often fought to the death, Taliban fighters largely threw down their weapons and returned to their villages, awed by the destructive capabilities of U.S. airpower.

After their defeat, there was little enthusiasm for an insurgency among the Taliban’s former leaders—and significant anger toward al Qaeda. In the long-standing Afghan tradition of reading the way the political winds are blowing, many Taliban sought to adjust themselves to the country’s new political reality. But the United States had no interest in allowing the Taliban to escape defeat and humiliation. It wanted to teach the group a lesson and, working with the country’s rapacious tribal warlords, launched an aggressive counterterrorism mission that targeted the Taliban’s former leaders. That decision helped turn Afghans, who had initially welcomed the U.S. presence, against the United States and the Karzai government. This provided fuel for a resurgent Taliban insurgency that began a few years later.

There are potential lessons for Israel in understanding the United States’ misjudgment and mishandling of the Taliban after 9/11. The PA may not be happy with Israel’s offensive in Gaza and will publicly condemn it, but it can be of potential assistance in dealing with the aftermath of the war. Israel should do everything it can to avoid turning the PA—which has recognized Israel and pledged support for a two-state solution—into an enemy. The PA’s limited authority, and its rampant corruption, will make this difficult, but there are public steps that can be taken to build goodwill.

Unfortunately, Tel Aviv seems committed to doing the opposite. Before October 7, there was a rising tide of settler-led violence in the West Bank, and this has only increased since the attack. Israeli leaders are willfully ignoring this violence because many of them sympathize with the settlers, who are a key part of the government’s current coalition. This inaction is not only morally indefensible but also politically misguided. Israel cannot hope to rely on PA support for help in administering postwar Gaza if it continues to allow settlers to attack Palestinian villages and their residents with impunity.

Israel needs to stop the violence in the West Bank immediately. It should also consider confidence-building measures, including announcing limitations on settlement growth, allowing more permits for Palestinians from the West Bank to work in Israel, releasing tax revenues that Israel collects for the PA, and freeing Palestinian political prisoners. But above all, Israel must address the underlying and legitimate grievances that drive support for Hamas. That means sitting down with the PA and negotiating a political resolution to their differences. Just as the United States should have accepted that the Taliban had a role to play in Afghanistan’s future, so, too, must Israel make tough political choices to end its conflict with the Palestinians. Ultimately, it is the only way to guarantee the country’s safety.

None of this will be simple. Prime Minister Benjamin Netanyahu has spent years villainizing and humiliating the PA. If Netanyahu were to resign—and a majority of Israelis want him to do so after the war is over, recent polls have shown—it would help with the process of mending fences.

Many Palestinians, meanwhile, would likely view a PA-led administration of Gaza as a quisling regime. Still, it is worth keeping in mind that when the United States went to war in Afghanistan, the conventional wisdom in Washington was that Afghans would resent the U.S. presence. The opposite happened: most Afghans welcomed U.S. forces and saw them as liberators. It is doubtful that things will unfold the same way in Gaza, though many Palestinians will be happy to be rid of Hamas. Only a tiny minority of Palestinians are bent on killing Israelis in acts of terrorism. Most want to live normal lives. Israel must not further alienate them. A heavy-handed occupation will only breed more resentment. Some of the young boys searching Gaza’s rubble for their family members after Israeli airstrikes in 2014 may have grown up to be among the young men murdering Israeli families on October 7.

Nothing about the war in Gaza will be easy. Many Israeli soldiers and Palestinian civilians will suffer and die. But every country has a right to defend itself against terrorism, and Israel is no different. After 9/11, the United States went to war with al Qaeda and, as Biden put it, “got justice.” Then American leaders threw away their political and moral advantages with a series of counterproductive and ill-considered decisions, squandering the early success in Afghanistan and creating a quagmire there. If Israel makes similar mistakes in its war against Hamas, it risks a similarly disastrous outcome.