By Mick Krever, CNN

In 2006 Iraq, Ali Khedery needed a problem solver.

The American occupation was in its fourth year, and the country was in disarray. Militias were gaining power in the country, and there was real concern about radical Islamists.

Khedery, as U.S. Special Assistant in Baghdad, found Nouri al-Maliki, leader of the Dawa party.

“We believed we needed a Shiite Islamist prime minister to crush the Shiite Islamist militias, along with Al Qaeda,” Khedery told CNN’s Christiane Amanpour on Tuesday. “And that is exactly what Nouri al-Maliki did from 2006 until 2008.”

Khedery was the longest continuously serving U.S. official in Baghdad.

But as Iraq’s violence ebbed, America’s bet on al-Maliki began to backfire, according to Khedery.

“By 2010, after violence had been reduced 90 percent since pre-surge highs, I lobbied the White House – including Vice President Biden and senior administration officials – that they needed to withdraw their support from Prime Minister Maliki.”

“We had very clear indications at that time that Maliki was trying to build a Shiite theocratic state around his political party and around himself,” just as Saddam Hussein had consolidated power around himself a couple of decades earlier.

“I tried to explain to them that he was very divisive; he was very sectarian; that we had very clear indications that he was increasingly beholden to Iran.”

Indeed, Khedery said, no less than the leader of the Quds Force in the Iranian Revolutionary guard, Qasem Soleimani, demanded of al-Maliki that he reject an agreement to keep American troops in the country past 2011.

“We knew all of these things in advance. None of these things are a surprise.”

“Some senators fault the Obama administration for not negotiating a renewed security agreement in 2011. But it was a foregone conclusion that the U.S. would not remain past 2011.”

“That was one of Qasem Suleimani's conditions on Prime Minister Maliki in return for forming his government – in Iran – in 2010.”

‘Prime Minister of the Green Zone’

After weeks of political disarray in Baghdad, Iraqi politicians took a small step forward on Tuesday, electing a parliamentary speaker. The last two sessions ended with MPs storming out of the sessions with no agreement.

But it is still unclear when a new president or prime minister might be chosen, and help alleviate the political and security crisis that has enveloped the country.

When al-Maliki took office for his second term as prime minister in 2010, Khedery said, one of the country’s Grand Ayatollahs called al-Maliki “not the prime minister of Iraq” but rather “the prime minister of the Dawa Party.”

“Today, a senior Iraqi official told me that Maliki is not the prime minister of Iraq; he is the prime minister of the Green Zone” – the heavily-fortified area of Baghdad were government buildings and foreign embassies are located.

“He clearly does not control the northern Kurdish third of Iraq; he does not control the central Sunni Arab center of Iraq; and he does not even control the Shiite southern third of Iraq, because Qasem Soleimani, Iran's paramilitary spymaster, controls that through the Shiite militias.”

The American decision to stick by al-Maliki was “a combination of delusion and denial – and we are going to pay a very heavy price for those mistakes for a very long time. And so will Iraqis.”

The current Sunni revolt against Baghdad is only partially, Khedery said, about ISIS, the Sunni extremist group.

Only about 5% of the “the roughly five million or six million” Sunnis raising mutiny against Baghdad are ISIS, Khedery said.

Around 20%, he said, are former Ba’athist officials, from Saddam Hussein’s government.

“And the other sixty or seventy or eighty percent are Sunni tribal elements who haven't had jobs, who haven't had electricity or water for the past decade. So they've had no stake in Iraq's success; they've had a stake in its failure.”

There are plenty of alternative, more inclusive, candidates to lead the country, he told Amanpour.

“There are more moderate, more reasonable, more uniting leaders. Frankly though, the problem is that a great part of the solution to Iraq's troubles is now in Tehran.”

What does Iran want?

For Iran, as the most powerful Shiite power in the region, the rise of ISIS – a Sunni extremist group – in neighboring Iraq has been an extremely worrying development.

So much so, senior security officials in Baghdad tells CNN, that Iran has deployed Revolutionary Guard units to Iraq to help fight back against ISIS.

“I don't believe they want to see Iraq fragmented, nor do they want to see Syria fragmented,” Khedery said.

“I spoke to two senior officials today, one in Baghdad from Prime Minister Maliki's coalition and another very senior Kurdish official. And both of them told me that the Iranians to this moment are continuing to back Prime Minister Maliki, because they view him as the strongest and most capable of the sympathetic Shiite Islamists who are sympathetic to Iran.”

But Tehran’s devotion to their man in Baghdad, he said, is not without limits.

“They are considering pivoting away from him, but they only want to do so after some of their proxies – the Iraqi military and the militias – score some points on the board and are able to achieve some tactical victories on the ground.”

A problem too big to ignore

It is clear that Americans, after more than a decade of war in Afghanistan in Iraq and Afghanistan, are war weary.

But the current crisis in Iraq, Khedery said, is too big to let fester.

“We have to be very honest that under President George W. Bush, the Iraq War was poorly conceived and poorly conducted. And then under President Obama it was poorly concluded.”

“So this is an issue that transcends both parties and both presidents, and has now become a grave issue of strategic significance to American national security – one which we cannot ignore.”