U.S. soldiers patrol a street in the Iraqi city of Kirkuk. (Saad Shalash — Reuters)

This much is clear: There will likely be some kind of U.S. military presence in Iraq after 2012.

How many American troops will remain behind, where they will be based and what they will do is the subject of a grindingly slow and frequently frustrating debate inside the Obama administration and the Iraqi government, said senior defense officials.

Most of the plans being discussed by the Pentagon and the White House would keep about 3,000 to 5,000 troops in the country as trainers, said U.S. and Iraqi officials. A force smaller than 3,000 would not have enough firepower if it were attacked, said military officials.

Some U.S. military officials in Iraq have pressed for a larger force of more than 10,000 troops to remain in the country to deter Iranian incursions, but it’s unlikely that the Iraqis would be willing to allow such a big force.

“With 3,000 troops, we could do some training,” said a senior military official.

The negotiations are complicated because Iraqi Prime Minister Nouri al-Maliki, who is handling the negotiations himself, cannot afford to alienate key members of his coalition government who are deeply opposed to any American presence; many have threatened to boycott the government if a deal is struck to keep U.S. forces in the country. Only Iraqi-Kurds have wholeheartedly backed a long-term U.S. presence in the country.

The Iraqis have said repeatedly that any remaining troops would have to be limited to training Iraqi forces. But U.S. officials said it is still not clear exactly what kinds of training the Americans would provide and how many trainers would be needed to accomplish the mission. “You don’t start with troop levels,” said a senior defense official. “You start with the mission – what they are going to do.”

The massive U.S. military mission in Iraq is now in its endgame. Only about 46,000 troops on 47 American bases remain, down from a high of 166,000 on 505 bases during the height of the “troop surge” in 2007.

Ali al-Moussawi, a Maliki adviser, said U.S. officials are considering proposals that 3,000 to 4,000 American troops stay on in the country after the Dec. 31 deadline.

Gowen reported from Baghdad.