WASHINGTON -- In the run-up to the war in Iraq, neoconservative hawks in and out of the Bush administration promised that the U.S. invasion would quickly transform that country into a strong ally, a model Arab democracy and a major oil producer that would lower world prices, even while paying for its own reconstruction.

"A new regime in Iraq would serve as a dramatic and inspiring example of freedom for other nations in the region," President George W. Bush told a crowd at the American Enterprise Institute in 2003, a few weeks before he launched the attack.

Ten bloody and grueling years later, Iraq is finally emerging from its ruins and establishing itself as a geopolitical player in the Middle East -- but not the way the neocons envisioned.

Though technically a democracy, Iraq's floundering government has degenerated into a tottering quasi-dictatorship. The costs of the war (more than $800 billion) and reconstruction (more than $50 billion) have been staggeringly high. And while Iraq is finally producing oil at pre-war levels, it is trying its best to drive oil prices as high as possible.

Most disturbing to many American foreign policy experts, however, is Iraq's extremely close relationship with Iran. Today, the country that was formerly Iran's deadliest rival is its strongest ally.

"These are the wonderful consequences of our intervention -- and the brilliance of it really is mindboggling," said Chas Freeman, a Middle East scholar and critic of the neoconservatives. "The extent to which Iraq has become an active collaborator with Iran ... is really very striking."

The U.S. is leading an intense international effort to pressure Iran to rein in its nuclear program. In January, the European Union agreed to join the U.S. embargo on Iranian oil, which went into effect this month.

Rather than help the U.S. in these endeavors, however, Iraq is doing quite the opposite. Iraq has been critical of the U.S. sanctions against Iran, and some fear it will help its neighbor avoid the penalty's sting by ferrying goods across their shared border.

Another top Obama administration goal in the Middle East is to push Bashar al-Assad's oppressive regime out of Syria. "For the sake of the Syrian people, the time has come for President Assad to step aside," President Barack Obama said last August.

But again, Iraq is working at cross-purposes to the U.S., decrying efforts to oust Assad and letting Iran use its airspace to ship weapons to Assad's government.

In fact, some Middle East scholars predict the rise of a Shiite Iran-Iraq-Syria axis, which could challenge Saudi Arabia and other Sunni Persian Gulf states for control of the region.

WANING U.S. INFLUENCE

Neoconservatives with the Bush administration imagined that post-invasion Iraq would serve as a staging ground for American military power in the region. The U.S. built about a dozen huge air bases, at a cost of around $2.4 billion, complete with long landing strips, massive fortifications and all the comforts of home. They clearly meant to stay.

They also intended to retain U.S. influence. The gargantuan U.S. embassy in Baghdad -- a heavily fortified compound the size of Vatican City -- is by far the largest the world has ever seen, and, at a cost of nearly three quarters of a billion dollars to build, the most expensive.

But even before the end of George Bush's presidency, the Iraqis insisted on setting a deadline for the departure of U.S. troops. And when Obama met that deadline in late 2011, the Department of Defense also had to turn over to the Iraqis all of those elaborate military bases.

The State Department has finally acknowledged that it needs to downsize its diplomatic presence in Iraq. Brett McGurk -- whose nomination to be the next U.S. ambassador to Baghdad was derailed by the release of some racy emails -- spoke bluntly in his confirmation hearing in June.

"Quite frankly, our presence in Iraq right now is too large," he said. "There's no proportionality also between our size and our influence. In fact, we spend a lot of diplomatic capital simply to sustain our presence."

The primary beneficiary of this colossal loss of U.S. influence in Iraq has been Iran.

The two countries share a long and sometimes tortured history. Their strongest bond comes from populations that are largely members of the Shia branch of Islam, rather than the Sunni branch, which is more common in the other Arab countries. The Shia clerics who are so influential in both countries frequently travel back and forth between the two, as well as sharing similar backgrounds and often being related by blood.

But the two countries' ethnic divisions -- Iranians are Persian, while most Iraqis are Arab -- and their fierce nationalism were exploited by Saddam Hussein, a Sunni, who turned Iraq into a bulwark against Iran, even going so far as to launch an eight-year war against Iran in 1980 that cost the lives of as many as a million soldiers.

When the U.S. toppled Saddam and purged his party's loyalists from the government and the military, Iran stepped in, providing support for both the Shia leaders working with the U.S. to form a new government and for the Shia militias that were fighting against the U.S. during its occupation.

Iraq's current prime minister, Nouri al-Maliki, is particularly dependent on Iran because of the political, religious and commercial influence it has exerted in his favor -- most recently in June, when Maliki’s ruling coalition nearly fell apart yet again.

To the extent that the internal political struggle in the Middle East is fundamentally between Shiite Iran and Sunni Saudi Arabia, it's clear to the Saudis where the Iraqis' allegiance lies. "He's an Iranian agent," Saudi King Abdullah said of Maliki in a March 2009 conversation with U.S. officials documented in a cable obtained by Wikileaks.

Maliki has "opened the door for Iranian influence in Iraq" since taking power, the king said.

Maliki still has some incentives to keep the relationship with the U.S. from going entirely cold. The State Department is still planning to spend nearly $5 billion in fiscal year 2013 on Iraq, half of it on maintaining its embassy. Iraq will also need the U.S.'s help operating the 36 heavily armed F-16s they recently bought, and it has designs on buying other modern weaponry as well.

But Maliki and other Iraqi leaders "understand that the U.S. will come and the U.S. will go," said Jamsheed Choksy, a professor of Iranian studies at Indiana University.

"People in the region know they can't count on the U.S. in the long term," he said. "If you're a Shia politician, you need Iran."

THE COIN OF THE REALM

Iraqi oil production is booming, at long last making it a major world supplier again. All that additional oil on the market is widely seen as being a blow to Iran, because it will help fill any shortfall caused by a boycott of Iranian oil.

But short of limiting its own production, Iraq is backing Iran as much as it can in the oil area as well.

Historically, there has been a split in the oil producer group OPEC between price hawks like Venezuela and Algeria, who want to drive the cost of oil as high as possible, and Gulf states like Saudi Arabia, who want to keep prices moderate.

At the most recent OPEC meeting, Iraq used its new clout to try to drive the prices up -- siding with Iran against the Saudis. It also backed a proposal that OPEC officially protest the new sanctions against Iran.

Both attempts failed, but some observers think Iraq could help Iran defy the sanctions in other ways.

"It remains to be seen whether the U.S. has enough leverage in Iraq to prevent Iraq from serving as a conduit for Iran for oil," Choksy said.

"They could, if they wanted to -- and they would never publicize this -- take Iranian oil across the border in tanker trucks, mix it with Iraqi oil, and send it out into the market as Iraqi oil," said Gary Sick, senior research scholar at Columbia University's Middle East Institute. (Iran recently did just that for Syria, when Syria faced an embargo of its oil exports but needed the money.)

Iraq's vast, unpatrolled border with Iran could also be a major conduit for illicit goods, making other sanctions ineffective.

FRIENDSHIP HAS ITS LIMITS

As significant as the alliance between Iraq and Iran is, however, it also might not last.

"Iran is far better off today with Iraq than it ever was with Saddam -- there's no comparison; but that doesn't mean that Iraq is a client state and takes its orders from Iran," Sick said.

"You have a government [in Baghdad] whose worldview is generally aligned with that of Tehran," said Michael Eisenstadt, a senior fellow at the Washington Institute for Near East Policy. But he said Iraqi leaders are adamantly opposed to the sort of clerical rule they see in Iran.

"Iran cannot dictate to Iraq," said Reidar Visser, a research fellow at the Norwegian Institute of International Affairs who runs an Iraqi politics website. "Iraqi Shiites still see their interests as being quite distinct from Iranian Shiites."

Sick thinks the Iran-Iraq alliance could fracture over oil, especially if the embargo hurts Iran badly. "Iran's national interest would be to take oil off the market" in order to send prices up and hurt Western economies, Sick said. "But Iraq is really getting ready to play the oil game. I see this as a potential clash of direct national interests."

The neoconservatives, meanwhile, continue to hold out hope. Over at the new headquarters of the Foreign Policy Initiative, executive director Jamie Fly says "it's not clear yet" where Iraq will end up.

"I don't think it's a complete perversion of what was promised," he said. "I think it's probably a mixed bag at this point, in terms of how Iraq has developed as a regional player."

Fly also blamed many of Iraq's failings on the Obama administration's troop pullout. "The problem is that the current administration has dropped the ball, and we've undermined our own ability to help ensure that Iraq stays on a positive trajectory," he said.

"My concern about some of the Iranian influence and the role that Iraq may or may not be playing vis-à-vis Syria is in large part because we don't have a military presence there anymore, and that has weakened our hand and limited our ability to make sure that they don't get drawn further into Tehran's orbit," Fly said.

Predicting what's next in Iraq is next to impossible. In virtually no scenario, however, do things turn out how the neocons intended.

"Whatever [the war] was about, which was never entirely explained, it hasn't worked out terribly well," said Freeman, "and in fact Iraq continues to evolve in ways that are, if not fatal to American interests, certainly negative."

CORRECTION: This article previously identified Nouri al-Maliki as Iraq's president. He is prime minister.


*************************

Dan Froomkin is senior Washington correspondent for The Huffington Post. You can send him an email, bookmark his page, subscribe to his RSS feed, follow him on Twitter or on Facebook, and/or become a fan and get email alerts when he writes.