Updated

The George W. Bush administration indirectly cooperated with a powerful Iranian spymaster in 2006 to unseat then-Iraqi Prime Minister Ibrahim al-Jaafari, the former U.S. ambassador to Baghdad, Zalmay Khalilzad, said in an interview.

The revelation offers a markedly different view of the Bush administration’s relationship with Iran, a country Mr. Bush once denounced as part of a global “axis of evil.” Though never outwardly friendly, the administration at the time tacitly allowed Iranian influence to work in Washington’s favor.

The American envoy and other U.S. officials believed then that Mr. Jaafari lacked the ability to tame sectarian tensions that ravaged Iraq following the overthrow in 2003 of Sunni strongman Saddam Hussein.

Mr. Khalilzad said Iraqi politicians informed him that Tehran shared this sentiment and was dispatching the head of its overseas military unit, the Qods Force, to Baghdad to press Mr. Jaafari to step aside.

That commander, Maj. Gen. Qasem Soleimani, is viewed by the Pentagon as perhaps the most powerful officer inside Iran’s military and intelligence services. He is also in charge of Iran’s overall policy toward Iraq.

Mr. Khalilzad said he instructed U.S. and Iraqi forces that April to allow Gen. Soleimani to enter the American-controlled Green Zone to deliver the news to the Iraqi politician. Mr. Jaafari was replaced later that year by Nouri al-Maliki.

“He came to get rid of Jaafari in the spring of 2006,” Mr. Khalilzad said. “He thought we didn’t know” that he was making the trip to Baghdad.

A senior Pentagon official who was based in Iraq at the time confirmed the diplomat’s account.

Mr. Khalilzad later this month is releasing a memoir, “The Envoy,” that details his tours as the American ambassador to both Iraq and Afghanistan at the height of U.S. wars there. In the book, he also details other Bush administration’s effort to cooperate with Iran in both countries, though with only limited success.

The book doesn’t reveal his decision to permit Gen. Soleimani to enter the Green Zone.

Mr. Khalilzad, in the book and interview, said Tehran proved to be surprisingly helpful in the months after the Sept. 11, 2001, terrorist attacks on the U.S., by assisting in installing Hamid Karzai as Afghanistan’s first president after the overthrow of the Taliban.

The Bush administration and Iran also held secret meetings in early 2003 in Geneva in an effort to form a common approach to Iraq as the U.S. prepared to overthrow Mr. Hussien, he said.

Mr. Khalilzad describes in his book the cat-and-mouse game the Americans played with Gen. Soleimani as the U.S. military occupation of Iraq stretched on.

The general was the mastermind of Iranian efforts to train and equip Shiite militias that were attacking U.S. and coalition forces inside Iraq. Gen. Soleimani also told Iraq’s former president, Jalal Talabani, that Mr. Khalilzad himself could become a target.

“I learned that Soleimani had been ranting about me,” Mr. Khalilzad writes. “‘Khalilzad is singularly the worst person in the world,’ he said, noting that he ‘personally wanted to come to Iraq and kill this Khalilzad.’”

The shared desire of both Washington and Tehran to unseat Mr. Jaafari in 2006 was a rare point of agreement between the two countries in Iraq.

Mr. Khalilzad said that by the next year, he pressed American forces to step up efforts to arrest Iranian and Qods Force officers who were operating inside Iraq. He said he didn’t rule out further talks with Tehran, but felt the U.S. needed to aggressively counter the Shiite militias that Iran had built up.

Click for more from The Wall Street Journal.