Tuesday was the worst day of the George W. Bush administration. The deal President Barack Obama has struck with Iran to curb its nuclear weapons program amounts to a pragmatic recognition that Iran has joined the U.S. as a crucial regional player not just in the Persian Gulf but also in the whole Middle East. Iran's rise wouldn't have been possible - - and the deal wouldn't have been necessary — had the U.S. not unleashed Iran from the regional power that did the most to contain it: Saddam Hussein's Iraq.

Start with the deal announced Tuesday, which reflects what the history books will identify as Obama's distinctive foreign policy approach. He inherited a world in which the unquestioned U.S. hegemony that followed the end of the Cold War was beginning to erode. Faced with rising powers such as China in the Pacific, Russia in eastern Europe, and Iran in the Middle East, Obama has responded by rejecting overt confrontation or aggressive containment that might lead to direct conflict. Instead, he's favored calm, pragmatic acceptance of the rise of the challenging power.

To hawks and proponents of containment, this amounts to a form of defeatism. But to a certain strand of foreign policy realists, it's just good common sense. If you can't — or won't — stop a power from rising, you might as well engage it and try to reduce the risks of violence.

The Iran deal exemplifies this pragmatism. The U.S. might, at some earlier stage, have bombed Iran to keep it from becoming a nuclear power. But Bush never did so, in part because the consequences were too uncertain and in part because U.S. troops in Iraq would've been extremely vulnerable to Iranian retaliation via Shiite militias.

Once bombing Iran was off the table, the U.S. had little leverage to stop Iran from obtaining nuclear weapons. Obama settled on powerful economic sanctions, and the Iranian regime responded by showing that although it didn't like them, they didn't represent an existential threat.

This positioning set the table for a deal in which Iran would stop short of getting nuclear warheads, while simultaneously remaining close enough to getting them that its regional geopolitical position would be strengthened. For its part, the U.S. would get a reduction in the probability of direct conflict between itself and Iran — an outcome that might've emerged if Iran had chosen to go to the brink and start stockpiling weapons.

From the U.S. perspective, this isn't much of a gain — a point you can expect to hear repeated in Congress over the next few weeks. But to a pragmatic realist, the point is that it's the most the U.S. could hope to get. The economic sanctions clearly weren't going to make Iran give up its nuclear program without its getting something else in response. That something is formal U.S. recognition of Iran's vastly strengthened regional position.

The Israelis and the Saudis are furious — precisely because they're the allies whom the U.S. has used as its proxies in maintaining its regional dominance. Now that the U.S. is acknowledging that it's no longer the sole regional hegemon, their position is substantially weakened.

Now notice why the U.S. found itself in this position. Had the U.S. never invaded Iraq, Saddam's Iraq would probably have continued to play its traditional role of containing Iran. The U.S. funded and armed Iraq during the Iran-Iraq War precisely to keep Iran penned in. The Saudis at the time were happy to see Iraq play that role, as was Israel. The Saudis didn't like it when Saddam turned on his erstwhile masters and invaded Kuwait. But after that miscalculation was reversed, Saddam's Iraq, even weakened by sanctions and a no-fly zone, remained a buffer against Iran. True, the Iranians supported Bashar al-Assad's regime in Syria and used Lebanese Hezbollah as a tool against Israel. But these were moves made within a regional power structure that remained basically unchanged.

The invasion of Iraq changed all that. Had Iraq emerged as a functioning democracy, and not a weak state with no military capacity to speak of, it might conceivably have still contained Iran. But that was unlikely. A democratic Iraq was always going to be Shiite-led, and a democratically elected Shiite government in Baghdad was always going to be relatively positive toward Iran. With no regional power to contain it, Iran could expand its influence by taking a more dominant role in Syria and by facilitating Hezbollah's emergence into the dominant force in Lebanon.

Did advocates for war within the Bush administration see it coming? Did they realize that, whether Iraq became democratic or not, they were creating conditions that would facilitate the rise of Iran? For some neoconservative true believers, victory in Iraq was always meant as a first step to overthrowing the regime in Iran, allowing the emergence of a pro-U.S. democratic government there. Others simply didn't think that a democratic government in Iraq would be pro-Iranian, because there would be an ideological divide over rule by the ayatollahs, which Iraqi Shiites had rejected and for the most part continue to reject.

There was some merit to this view — Iraq's Shiites are certainly more pro-Iran because they live in a weak state and Iran is a powerful neighbor that's never going away. But the regional goal of containing Iran was a lot to put on a future democratic government of Iraq.

The upshot is that U.S. failure to replace Saddam's Iraq with a functioning government in a strong state is the reason Obama has made this deal with Iran. History will judge his decision — as it's already judging Bush's.

— Noah Feldman is a professor of constitutional and international law at Harvard and the author of six books, most recently "Cool War: The Future of Global Competition."