At first glance, Donald Trump looks like Islamic extremism’s worst nightmare. Trump said he would ban the billion-plus Muslims around the world from visiting the U.S. He would send the medieval ISIS back to the proverbial Stone Age: “Bomb the shit outta them.” In Tuesday’s Republican debate, Trump underscored his previously stated desire to deliberately kill the families of ISIS members. “I would be very, very firm with families. Frankly, that will make people think because they may not care much about their lives, but they do care, believe it or not, about their families’ lives.”

From another angle, however, Trump and ISIS are effectively, if not intentionally, helping each other. They don’t communicate. There’s no moral equivalence between them. Nevertheless, Trump and ISIS aid each other’s agendas in a strange combination of the coiffured and the caliphate. Even in a Republican Party that has drifted closer to Islamophobia in recent years, Trump stands out for his polarizing rhetoric, which poses a threat to openness and tolerance in the United States. “Terrorists like ISIL are trying to divide us along lines of religion and background,” as President Obama warned recently. “Prejudice and discrimination helps ISIL and it undermines our national security.”

The Trump-ISIS symbiosis reveals a bigger story. International politics often looks like a contest between opposing countries, terrorist groups, and insurgencies. But the hardliners on all sides may be working together—deliberately or inadvertently. In other words, there’s a global confederation of extremists.

“Hardliner” refers to an uncompromising mentality, which lumps enemies together; sees the world in black-and-white, “good-versus-evil” terms; and backs extreme responses to perceived threats. Today, hardliners are often found on the populist right, preying on economic insecurity and fears of terrorism: Trump in the United States, Marine Le Pen’s National Front in France, or Viktor Orban’s “illiberal state” in Hungary. But there are also plenty of hardliners in communist countries as well as in the Islamic world. The ultras—whether they’re in Raqqa, Tehran, Washington, or Tel Aviv—can form a symbiotic relationship. Like tango dancers, the hardliners move in a close embrace, taking steps that facilitate the actions of the other.

First, hardliners on opposing sides may communicate a surprisingly similar narrative of the conflict in which they’re involved. In their values, ISIS and Trump are polar opposites. ISIS insists that women cover their bodies by wearing veils, abayas, and gloves—whereas Trump used to run the Miss Universe Organization. Trump probably knows little about ISIS’s apocalyptic understanding of Islam. ISIS would find Trump’s politics similarly incomprehensible.

And yet they both to varying degrees promote the same story of a clash between the West and Islam. Radical Islamists try to mobilize support by tying their cause to the banner of faith. ISIS propagates a narrative where Muslims are under assault by Christians, Jews, and atheists, and violent resistance offers salvation. Meanwhile, hawkish Republicans insist on Islamizing terrorism by continually modifying the term with “radical Islamic” or just plain “Islamic,” and pour scorn on Obama for downplaying the religious dimension. Last week, Trump tweeted: “Well, Obama refused to say (he just can’t say it), that we are at WAR with RADICAL ISLAMIC TERRORISTS.” With a few edits, ISIS might have sent the same tweet. (Worryingly, Trump’s narrative is catching on. According to one poll, a plurality of 42 percent of Republicans support the ban on Muslims entering the country. Despite Trump’s lack of national-security experience, GOP voters trust him more than any other Republican candidate to tackle terrorism.)

Second, hardliners represent each other’s meal ticket. They may rail against the enemy, but the enemy is what keeps them in business. The ultras try to defeat the moderates on their own side by forcing them into a binary choice: Either you’re with us, or you’re with the terrorists (or the infidels). The key to this strategy is the adversary’s vitriolic hatred and violence, which sends the moderates fleeing to the extreme.

Time and again, ultras have attacked moderates from opposing sides. During the early 1990s, Israeli Prime Minister Yitzhak Rabin and Palestinian leader Yasser Arafat pursued a peace process that resulted in the Oslo Accords and a famous handshake in 1993 at the White House. But rejectionists on both sides landed hammer blows that derailed the process. Hamas launched a wave of terror attacks, seeking in part to incite Israeli opinion against the deal. In 1995, Yigal Amir, an extremist Israeli and a supporter of Jewish settlements, shot Rabin dead, explicitly to prevent a peace deal.

Under the shadow of Hamas missiles, Israelis lurched to the right. During the last decade, rocket-fire from Gaza into Israel steadily expanded in range. One study found that after an Israeli city fell within Hamas’s target sights, that city saw a significant increase in support for right-wing parties. In turn, radical Israeli settlers launched “price tag” attacks on Palestinians, hitting symbolic targets like mosques to intimidate Palestinians, but also to provoke reprisals, force the Israeli military to send help, and ultimately protect settlements in the West Bank. Today, peace in the Holy Land seems as far away as ever.

It was a similar story between Israel and Iran. For Israeli hardliners, Iran’s previous president, Mahmoud Ahmadinejad, was a useful enemy who could be relied upon to issue incendiary rhetoric, including Holocaust denial, that only aided the hawkish cause. Danny Ayalon, a right-wing Israeli politician and former ambassador to the U.S., described Ahmadinejad’s rhetoric as “the gift that keeps on giving.”

Iranian hardliners served much the same function in the United States during negotiations over Iran’s nuclear program. In the lead-up to the deal, which hardliners in both countries opposed, Jamal Abdi, the policy director of the National Iranian American Council, cited a “symbiotic relationship” between them and said: “The hawkish rhetoric by Iranians feeds the rhetoric of hawkish Republicans.” The front page of the conservative Iranian paper Kayhan, he noted, “reads like the ticker on Fox News.”

In the United States, terrorist attacks like the one in San Bernardino heighten fears of immigration, boost support for Trump’s hardline message, and push him closer to the Republican nomination. “Every time things get worse,” Trump crowed after San Bernardino, “I do better.”

And the benefits go both ways. Trump’s emphasis on the “Islamic” nature of extremism legitimizes the opposing side’s message, and antagonizes Muslim moderates who naturally bristle at the implied association with terrorism. ISIS’s own propaganda spells out its strategy of “polarizing” Muslims by making life impossible for the moderates—a strategy that Trump, through his rhetoric, is abetting. If Trump actually turned this rhetoric into political reality, it would confirm the Islamists’ argument that the United States is implacably opposed to their religion. To, in Trump’s words, “take out” completely innocent civilians simply because they are the parents, siblings, or children of ISIS members is not only morally abhorrent—it would be a catastrophe for America’s global image.

Third, in contrast to the unintentional symbiosis between Trump and ISIS, hardliners around the world sometimes coordinate their actions more explicitly. Syrian President Bashar al-Assad, for example, appears to have deliberately fostered the rise of ISIS by releasing radical prisoners from jail, and targeting air strikes against more moderate opposition groups—in a bid to make himself look like the lesser evil for foreign and domestic audiences. In turn, ISIS appears to be in no rush to overthrow Assad and focuses instead on building its caliphate.

Hawks may try to stop peaceful negotiations by inviting their counterparts abroad to act as spoilers. Last March, Republican senators attempted to derail the Iran nuclear deal by sending an open letter to Iran’s leaders threatening that a future president could revoke any bargain “with the stroke of a pen.” Obama responded: “It’s somewhat ironic to see some members of Congress wanting to make common cause with the hardliners in Iran. It’s an unusual coalition.”

Of course, sometimes, the hardliners are right and no compromise with the enemy is possible, like in World War II. But these cases are truly exceptional. More often, international politics is about managing problems, bargaining, and cutting deals. Practically no one wants to negotiate with ISIS. But Trump doesn’t seem to realize that allying with mainstream Muslims is the only way to defeat Islamic extremism. His hawkish rhetoric feeds the story of the Islamic radicals he claims to oppose.

What’s the solution? If hardliners have a kind of global confederation, then moderates must also build their own international networks. This means rethinking who is an ally and who is an enemy: The moderates on the other team may be closer partners than the extremists on one’s own side. It means finding ways to help moderates in foreign countries outmaneuver hawks. It means avoiding narratives that only aid the ultras’ agenda. Yitzhak Rabin and Yasser Arafat had once been enemies, but during the peace process, the two men saw themselves as companions traveling on a dangerous road together. After receiving news of Rabin’s death, Arafat wept.

In Tuesday’s GOP debate, when Senator Rand Paul pushed back against the idea of deliberately killing the families of ISIS members, Trump replied: “So, they can kill us, but we can't kill them? That's what you’re saying.”

The United States should not become like ISIS. That’s exactly what I’m saying.