U.S. officials on Wednesday welcomed Iraq’s decision to negotiate with Washington on keeping some U.S. troops in the country into next year, seeing it as a move toward ending the months-long political stalemate that has complicated U.S. plans for a December withdrawal.

Iraq’s top political leaders agreed late Tuesday that the Iraqi military needs to continue training programs with U.S. forces, marking the first step in a process that still could take months to resolve.

“There seems to be broad partnerships and political coalitions emerging that take tough decisions,” said a senior U.S. Embassy official, who spoke on the condition of anonymity to discuss the issue frankly. “This is very good, because we don’t want to be the security partner to a dictatorship or to a one-party regime, but rather, we believe we should have acceptance by a broad range of political forces in this country.”

Iraqi and U.S. officials cautioned Wednesday that Iraq’s precarious political and security situation could yet derail efforts to resolve the issue before the roughly 46,000 U.S. troops in Iraq leave as scheduled by Dec. 31.

Prolonging a final decision could turn the issue into a “physics problem” for the U.S. military if it is pressed to decide which forces and equipment need to stay too close to year’s end, Adm. Mike Mullen, chairman of the Joint Chiefs of Staff, said Tuesday in Iraq.

Significant details that remain unresolved include the length and focus of any training program, how many U.S. troops such training might require and how Iraqi leaders would formally request and approve a new partnership. Mullen and his colleagues also want legal immunity for any troops who stay behind.

Even as Washington seeks to curtail the costs of military operations in Iraq and Afghanistan, some defense analysts contend that the United States needs to maintain at least some troops here.

“We don’t need a large combat presence,” said Anthony Cordesman of the Center for Strategic and International Studies. “We need Special Forces and perhaps some forces who would be effectively combat troops.”

To prevent hard-won security gains from slipping away, Cordesman said, U.S. troops should seek ways to continue operating in north-central Iraq, along the border with the semiautonomous Kurdish region, where violence between Kurds and Arabs sometimes flares.

Jula Haji, a member of parliament with the Kurdish Democratic Party, said U.S. forces could be used in other parts of the region to ward off Iranian forces bombing Iraqi Kurdish villages. Such attacks “are a sign that we still need” U.S. military support, she said.

American officials and other observers agree that a sustained U.S. training presence could also help the Iraqis shore up their external defense capabilities and encourage them to buy more equipment from the United States. On Saturday, Prime Minister Nouri al-Maliki announced plans to buy 36 U.S. F-16 fighter jets, in part to sustain a military partnership.

U.S. officials also want troops to stay in Iraq as a check on Iran, which is seen as retaining a strong influence over many of Iraq’s leading politicians, including Maliki. The Islamic republic is engaged in a charm offensive in Iraq, opening consulates, investing in the economy and sponsoring religious scholarships.

The Americans accuse Iran of training and equipping Iraqi insurgent groups that are attacking Iraqi civilians and U.S. troops, further destabilizing the country’s security.

Privately, some Iraqi lawmakers also want the U.S. military to continue serving as a counterweight to Iran, but they rarely say so publicly for fear of defying widespread Iraqi opposition to U.S. forces. When American troops left Iraqi cities in 2009, people danced in the streets in celebration.

Maliki has stressed Iraq’s sovereignty as a point of pride. Politically, the prime minister knows that anti-U.S. cleric Moqtada al-Sadr, whose powerful political bloc is key to maintaining the coalition government, would try to block anything that looked like a continued U.S. presence, if only to maintain popularity with his power base. But if Maliki can build a coalition on this issue with rival lawmaker Ayad Allawi, as now looks possible, Sadr’s contingent would probably be too small to block a decision.

Regardless, now that the country’s top leaders have agreed to move forward, Haji said she hopes they will act quickly, because “inside their hearts, the heads of the Iraqi political blocs know they want to have the Americans here for a long time.”

Fordham reported from Washington. Special correspondent Asaad Majeed in Irbil contributed to this report.