Updated

The American military, along with its international partners, will need to remain in Iraq even after the expected defeat of the Islamic State group, outgoing Defense Secretary Ash Carter said Saturday.

Carter said the U.S. and its coalition partners must not stop after completing the current campaign to expel ISIS from Iraq's second largest city of Mosul.

He said the militants are on a path to lasting defeat.

"But there will still be much more to do after that to make sure that, once defeated, ISIL stays defeated," he said, using an alternative acronym for ISIS. "We'll need to continue to counter foreign fighters trying to escape and ISIL's attempts to relocate or reinvent itself. To do so, not only the United States but our coalition must endure and remain engaged militarily."

Related stories...

"In Iraq in particular, it will be necessary for the coalition to provide sustained assistance and carry on our work to train, equip, and support local police, border guards, and other forces to hold areas cleared from ISIL," said Carter.

Carter did not say how long this continued U.S. military presence might be necessary or how many troops would be required. At any rate, those decisions are likely to fall to the Trump administration after it takes office in January.

While describing recent Pentagon actions to put a stranglehold on ISIS worldwide, Carter said the Obama administration has directed the secretive Joint Special Operations Command to prioritize destroying the militant group's ability to conduct attacks in the West.

Carter said that in his final weeks in office, he is focused on ensuring a smooth transition to his successor.

Earlier this week, President-elect Donald Trump announced that he intends to nominate retired Marine Gen. James Mattis to be his defense secretary.

Carter congratulated Mattis on Saturday, who is a former commander of U.S. Central Command overseeing the wars in Iraq and Afghanistan.

"I've worked with Jim for many years, he's a friend, and I hold him in the highest regard," Carter said. He made no mention of the aspect of the Mattis selection that has drawn the most attention: the fact that his nomination will require legislation by Congress to exempt Mattis from a legal prohibition on a retired military officer serving as secretary of defense before he has been out of uniform for a minimum of seven years. Mattis retired in 2013.

Carter made his remarks at the Reagan National Defense Forum at the Ronald Reagan Presidential Library and Museum.

Fox News' Lucas Tomlinson and the Associated Press contributed to this report.