The U.S. may need to keep as many as 20,000 troops and other military personnel in Iraq, even after the Islamic State is driven out, to stabilize the country, the former head of the Pentagon's policy shop said Thursday.

A postwar force of between 4,000 to 8,000 American troops "is probably sufficient" to help local security forces ensure security in Iraq as ISIS faces defeat in its final stronghold in Mosul, Eric Edelman, the Pentagon's top policy official during the George W. Bush administration, said in an interview.

The U.S. forces would likely be deployed as advisers, not combat troops, to support Iraq's police and military forces, he said.

"We are dealing with an an ISIS that is severely, severely weakened" after nearly two years of constant war against U.S.-backed Iraqi and Kurdish forces, said Mr. Edelman, who is now a senior fellow at the Center for Strategic and Budgetary Assessments (CSBA), a Washington-based defense think tank.

The 5,000 to 20,000 troops called for in the report would provide enough military support for Iraqi forces to hold their own on the conventional battlefield and battle ISIS remnants with a classic counterinsurgency strategy.

The 5,000-man footprint tracks closely the troop levels authorized by President Obama when U.S. operations against ISIS in Iraq began in 2014. The high-end estimate would match the U.S. invasion force sent into Afghanistan in 2001.

U.S. and Iraqi officials say ISIS has lost nearly all its territory in the country and is poised to lose its Iraqi capital of Mosul. As battlefield and territorial losses mount, the group may be returning to its insurgent roots.

"There is an imperative for some kind of residual U.S. military presence in Iraq," to ensure an ISIS-led insurgency does not drive the country back into the bloodshed and violence that engulfed the country during the darkest days of the American war, the report's author and CSBA Senior Fellow Hal Brands said.

Negotiations have begun between Iraqi Prime Minister Haider al-Abadi and U.S. officials in Baghdad on a new status of forces agreement, or SOFA, which will outline the legal and diplomatic parameters underpinning a long-term U.S. military presence in the country.

Mr. Edelman and Mr. Brands said the remaining U.S. forces will provide Mr. Abadi political cover against opponents of a long-term military mission in Iraq. Influential Shi'ite cleric Muqtada al-Sadr vehemently opposes any American deployments into postwar Iraq. Other Iranian-backed Shi'ite groups are also lining up against an extended U.S. mission in the country.

Mr. Abadi will likely forgo a parliamentary vote on any SOFA deal and issue an agreement via executive action, Mr. Edelman said. The inability by former Iraqi Prime Minister Nouri al-Maliki to push a SOFA deal through parliament resulted in the full withdrawal of U.S. forces from the country in 2011.

"My hope is the experience of 2014 may prove that ... it may be worth paying a political price for keeping U.S. forces in the country," Mr. Brands added, regarding acceptance of a prolonged American presence by Iraqis.

Iraqi Shia will likely remain split over support for the U.S. postwar mission, while Iraqi Sunnis and Kurds will embrace the deal, since they see American forces as a necessary "balance against Iranian influence," Mr. Edelman added.

Tehran's growing influence in the country, most notably via the network of majority Iranian-backed Shia militias known as Popular Mobilization Forces, or PMF, could weigh heavily on any decision by the Pentagon to put more boots on the ground in Iraq.

"One of the problems in the [coalition] campaign is that the partner [forces] hate each other more than they hate ISIS," Mr. Brands said. "As ISIS gets closer to defeat, those underlying conflicts ... are coming to the surface in a major way."