In a June 2 videoconference with Mr. Maliki, the president emphasized that any agreement would need to be ratified by the Iraqi Parliament. But not everybody in the American camp agreed with this stipulation.

Brett H. McGurk, a former Bush administration aide whom the Obama administration had asked to return to Baghdad to help with the talks, thought that a bruising parliamentary battle could be avoided by working out an understanding under an existing umbrella agreement on economic and security cooperation — an approach Mr. Maliki himself suggested several times. But the White House wanted airtight immunities for any troops staying in Iraq, which American government lawyers, the Iraqi chief justice and James F. Jeffrey, the American ambassador in Baghdad, insisted would require a new agreement that was endorsed by the Iraqi Parliament.

The negotiations were complicated by the Americans’ failure to broker a power-sharing arrangement. With Iraqi leaders jockeying for influence and Mr. Allawi still out of the government, neither Mr. Maliki nor his rival wanted to stick his neck out by supporting a continuing American military presence, no matter how small…

Without American forces to train and assist Iraqi commandos, the insurgent group Al Qaeda in Iraq is still active in Iraq and is increasingly involved in Syria. With no American aircraft to patrol Iraqi airspace, Iraq has become a corridor for Iranian flights of military supplies to Bashar al-Assad’s government in Syria, American officials say. It is also a potential avenue for an Israeli strike on Iran’s nuclear installations, something the White House is laboring to avoid.