Why, after so many months, was the US-Iraq security pact approved now? True, the two countries were facing a deadline of December 31, when the UN authority for the occupation expires, but they could have gone back to the UN for a temporary extension or simply signed a bilateral statement not nearly as involved as the Status of Forces Agreement (SOFA)approved yesterday by the Iraqi Cabinet.

Here’s the reason, in my opinion. The election of Barack Obama changed Iran’s calculus, and so Iran decided, very subtly, to shift to neutral on the pact. As a result, many politicians in Iraq who are either influenced by Iran or who are outright Iranian agents now support the pact. It’s an important sign from Tehran to Obama that they’re willing to work with the United States.

For months, the United States has blamed Iran for sabotaging the prospect for an agreement, and there’s little doubt that had John McCain won the election, Iran would have concluded that the likelihood was very high that Iraq would be used as a base for attacking Iran over its nuclear program.

The New York Times mentions the role of Iran in passing:

“Several political analysts suggested that Iranian opposition to the pact had softened because of the American presidential election victory of Senator Barack Obama. He has suggested a more diplomatic approach to Tehran and has described a withdrawal timetable from Iraq faster even than the one laid out in the security agreement, though recently he has qualified that stance.

“‘If George Bush’s presidency were going to continue on through 2012, I think people would be a lot more concerned,’ said Karim Sadjadpour, a Middle East analyst at the Carnegie Endowment for International Peace. ‘Having this administration really lightens the blow for the Iranians.'”

The revised pact is designed to give specific assurances to Iran that Iraq won’t be used as a base to launch an assault on Iran. Ironically, this part of the pact was added after US special forces crossed from Iraq to Syria last month to attack alleged insurgents there. That act, which outraged many Iraqis, only underscored the danger of unchecked US forces based in Iraq. Notes the Times:

“A section of the agreement that Iraqi officials said barred the United States from launching attacks on neighboring countries from Iraq also may have diminished Iranian resistance.

“‘We sent messages to neighboring countries to say, “This is in our interest,” ‘ said Mr. Fayyadh, the Shiite lawmaker. ‘Specifically we spoke to the Iranians and gave them guarantees that “no one will use our country to attack you.” ‘ There was no immediate reaction from Iran to the vote.”

That doesn’t mean that Iran is thrilled about the idea of American troops staying in Iraq for three more years, as the pact provides for. But the pact does restrict the activities of those forces, in a way that makes Iran happy, and it doesn’t preclude the possibility of an even faster pullout, if President Obama decides to do so. But it does allow for US forces to stay in Iraq through the end of 2011, training and supplying the Iraqi armed forces and police, which means that the Iraqi government — led by a strongly pro-Iranian coalition of Shiite and Kurdish parties — will gain strength.

One sign of Iran’s ambivalence: some Iranian media, at least, played up the opposition to the pact from Muqtada al-Sadr, the quixotic Shiite cleric whose Mahdi Army has been a force in Iraq since 2004. Press TV, an Iranian government mouthpiece, ran a headline today at the top of its news page reading: “Parliament will reject US-Iraq pact.” The article cited opposition from the Sadr bloc, which will oppose it in parliament and carry out large-scale public protests. Sadr has also threatened violence against the US occupation if he and his allies are unable to block the pact.

So far Iran is content to have its allies inside the Iraqi government endorse the pact, and see what happens with Obama. If things go sour, expect Iran to shift toward a more radical stand in Iraq, even supporting Sadr and an increase in violence, in order to put pressure on the Obama administration.

So what happens in parliament now? It’s not a done deal, but approval seems likely. Debate starts today, and it is scheduled to conclude by November 24. So confused is Iraqi politics that the government of Nouri al-Maliki is claiming that the pact needs only a 51 percent majority in parliament to be approved, while opponents assert that passage requires a two-thirds vote. That could make a big difference, because the alliance of Kurds, who strongly support the pact, and Shiite religious parties, which also back it (though less enthusiastically), can easily get to 51 percent, but they will have a harder time getting to a two-thirds majority.

The Wall Street Journal reports that the US government and the Iraqi government are “lobbying” members of parliament to support the pact. It isn’t totally clear how the Sunni bloc will vote, and they’re apparently divided. There is also Shiite opposition to the pact, beyond Sadr.

The opposition bloc in parliament includes a disparate group of nationalist and secular parties, including Sadr’s movement, the Sunni bloc, the Shiite Fadhila party, the secular nationalist party led by Iyad Allawi, and assorted other Shiites, including some members of the ruling Dawa party who’ve broken with Maliki. If every single one of them votes against the pact, it will fail. But the US and Maliki and using a divide-and-conquer strategy, and Iran’s likely behind-the-scenes tacit support will help pass it, too.

Of course, in Iraq, opposition comes armed. Not only Sadr’s forces, but the Sunnis — including the Sunni-led resistance groups — might express their opposition to the pact in the streets. That could be especially true if the scheduled January 2009 elections for provincial government take place on time.

None of this ties Obama’s hands. The pact calls for the pullback of US forces to bases outside Iraq’s cities by June 30, and for the complete withdrawal of all US forces by 2011. That isn’t too far from Obama’s own proclaimed strategy, which called for the withdrawal of all US combat forces — about 75,000 troops — by mid-2010. The rest of the US force, perhaps 60,000 to 70,000 troops might stay, under Obama’s plan, as a residual force, in part to train and equip Iraq’s armed forces. Or, Obama could choose to withdraw them, too. (During the campaign, he was vague about that.) The pact, at least, seems to put an end date on those forces of 2011, but of course it’s all something that can be amended.

The real questions for Obama now are: Will he stick to his pledge to drawdown US troops at the rate of one to two brigades, as he promised, even though there will be enormous opposition to that plan from the US military? Will he agree to take out the so-called residual force, once the combat troops are gone? And, because Obama needs the help of all of Iraq’s neighbors to underwrite a political accord there, can he reach an agreement with Iran — the so-called Grand Bargain — so that Iran doesn’t try to destabilize Iraq in the future?