The driving force behind American foreign policy in recent years has been hubris. The United States sees itself as the essential unipower, endowed with the right, indeed the duty, to intervene around the world. Any nation that gets in the way must be crushed—but in a moral, compassionate way.

Fortunately, President Donald Trump rejects Full Neocon, the foreign policy equivalent of the Full Monty. In his State of the Union speech, he declared: “Great countries do not fight endless wars.” He appears ready to pull U.S. troops out of Syria and Afghanistan.

Unfortunately, hubris continues to dominate his administration’s policy towards another nation: Iraq.

The Bush administration invaded Iraq based on a lie and a fantasy. The former was Baghdad’s supposed possession of a nuclear program; the latter was the expectation that adoring acolytes would enthusiastically create America on the Euphrates.

Thousands of Americans died, tens of thousands of U.S. personnel were injured, hundreds of thousands of Iraqis perished, and millions were displaced in a crescendo of sectarian violence. The indigenous Christian community was destroyed.

Out of the war emerged al-Qaeda in Iraq, which eventually morphed into the Islamic State. Only with substantial assistance from Washington and other governments was the Iraqi military able to liberate ISIS territory. Meanwhile, majority Shiite Iran gained influence among its neighboring coreligionists. Indeed, a new detailed U.S. Army study of the war concluded that “an emboldened and expansionist Iran appears to be the only victor.”

You’d think such a record would make Washington cautious in dealing with Iraq in the future. The relationship there now is both practical and transactional, with significant undercurrents of hostility. Baghdad wants American support but not its domination.

Yet Trump has treated Iraq as a conquered province.

Most Americans don’t remember when Washington was fervently pro-Saddam Hussein. In 1980, he invaded Iran, after which he enjoyed plentiful U.S. backing. That changed only in 1990 after he seized Kuwait. In 2003, George W. Bush used the 9/11 attacks as a pretext for invading Iraq.

The neoconservatives promised an easy victory—a “cakewalk,” one said—followed by an even easier occupation that would require few troops and cost few dollars. Alas, these plans went dramatically awry. Nevertheless, as the sectarian conflict finally wound down, American officials still hoped to maintain a permanent military presence. What’s the fun in invading and occupying another state if you can’t leave some forces behind?

The Bush administration insisted on a Status of Forces Agreement (SOFA) to protect American troops in Iraq. Prime Minister Nouri al-Maliki refused. He explained: “We did not realize that the U.S. demands would so deeply affect Iraqi sovereignty, and this is something we can never accept.” Indeed, he added, “we cannot allow U.S. forces to have the right to jail Iraqis or assume, alone, the responsibility of fighting against terrorism.”

A temporary extension was agreed to shortly before Bush left office, but with the promise that American forces would leave by December 2011. President Barack Obama came to office hoping to maintain a small residual force in Iraq. However, Iraqis again refused to grant American troops immunity from prosecution in Iraqi courts.

Obama’s critics insist he did not try hard enough, but the Iraqi government lacked parliamentary support to pass the agreement. In fact, fewer than one in five Iraqis backed a continuing U.S. presence. Obama seemed relieved when negotiations over a SOFA failed, but he was not responsible for that failure.

Alas, seeds planted by the invasion, in this case al-Qaeda in Iraq, eventually sprouted into ISIS. Republicans blamed Obama’s withdrawal for the disaster. If only he had kept Iraq as an occupied territory, they said, peace would have reigned. What they ignored was the will of the Iraqis. Neocons view foreigners as essentially stage props in an American play. But Iraqis really believed that they were sovereign and could say no.

Moreover, the claim that a continued U.S. presence would have prevented the rise of the Islamic State ignores the underlying political and social causes of the conflict. Observed Georgetown University’s Shireen Hunter: “The most significant factor behind Iraq’s problems has been the inability of Iraq’s Sunni Arabs and its Sunni neighbors to come to terms with a government in which the Shias, by virtue of their considerable majority in Iraq’s population, hold the leading role.” Even blunter was James F. Jeffrey of the Washington Institute for Near East Policy, who served as U.S. ambassador to Iraq from 2010 to 2012: “The common argument that U.S. troops could have produced different Iraqi political outcomes is hogwash. The Iraqi sectarian divides, which ISIS exploited, run deep and were not susceptible to permanent remedy by our troops at their height, let alone by 5,000 trainers under Iraqi restraints.”

Indeed, more than a few Iraqis would have likely turned their supposed American guardians into targets. U.S. forces would have provided a source of unity for Shia and Sunni—drive out the hated occupier.

Shiite leader Muqtada al-Sadr created the Mahdi Army and targeted the American military during its occupation of “Sadr City.” Responsible for killing hundreds of U.S. military personnel, he might have staged an encore had Americans stuck around in 2012. He has not changed. During last year’s parliamentary campaign, he warned that Shia militias could attack American troops if they stayed too long. After the last election, in which his movement came in first, he declared that “the U.S. is an invader country” and his supporters would “not allow [America] to interfere at all.”

Qais al-Khazali runs the Iranian-backed militia Asaib Ahl al-Haq. Reports Michael Knights and Frzand Sherko of the Washington Institute for Near East Policy, al-Khazali “in January 2007 worked with Iran to orchestrate and carry out the cold-blooded kidnapping and murder of five U.S. soldiers in Karbala.” More recently, the group “is credibly accused of murdering” numerous Iraqis accused of violating Islamic law. American occupiers might have ended up on the same death list.

The president flew into Iraq after Christmas to visit American troops—roughly 5,200 are still on station, training Iraqi forces and providing reconnaissance and air support for Iraqis in combat. But he raised hackles in Baghdad by failing to meet with Iraqi leaders.

Still, the reaction to his trip was relaxed compared to his declaration that American troops might stick around to watch Iran “because Iran is a real problem.” Moreover, he added, “we could use this as the base if we wanted to do something in Syria.”

Prime Minister Adel Abdul-Mahdi quickly declared: “When it is said that the mission of these [forces] is to fight a neighboring country, like Iran, for example, we reject that notion.” President Barham Salih said the U.S. should not burden Iraq with Washington’s “policy priorities,” insisting, “don’t overburden Iraq with your own issues…we live here.” He added: “It is of fundamental interest for Iraq to have good relations with Iran.”

Former prime minister Haider al-Abadi warned: “Talking about U.S. military bases in Iraq for the purposes of confrontation complicates the relationship with neighboring countries.” Parliamentarian Jawad al-Musawi explained: “There is distrust of the American government—even if they say they are coming to protect us against Daesh [the Islamic State], the real reason they will be coming is to hit Iran.”

Ali Choukeir of Agence France-Presse warned: “Ousting U.S. troops from Iraq despite Donald Trump’s vow to stay is now the top goal of pro-Iranian Shiite armed groups. And their leaders say there are only two ways—by passing a new law, or by force.” Al-Sadr, who controls a large bloc in parliament, pushed to fast-track legislation to constrain America’s presence and operations. Al-Khazali called on parliament to reduce America’s role or the militias would act. He threatened: “Iraq has forces…that can remove American forces from Iraq—whether they be 5,000, 7,000, or even 9,000 soldiers—in one dark night.”

These claims may be bluffs, but these groups also fought against ISIS. Mohammed Mohie, spokesman for the Hezbollah Brigades in Iraq, noted that confronting America would allow long-divided Shia factions “to find an external threat on which to focus attention rather than their internal problems.”

The real solution here is for the United States to leave. ISIS as a physical caliphate has been destroyed. The rest of the work must be completed by those nations that are directly threatened by the Islamic State. As for Iran, let its neighbors do the watching and containing. Tehran poses no meaningful threat to America and is surrounded by moneyed governments capable of defending themselves.

The president recognizes the folly of endless war in the Middle East. It’s time for him to apply that same skepticism to Iraq. America’s security is best served by staying out of conflicts in a region of diminishing importance.

Doug Bandow is a senior fellow at the Cato Institute. A former special assistant to President Ronald Reagan, he is author of Foreign Follies: America’s New Global Empire.