BAGHDAD (Reuters) - U.S. Defense Secretary Ash Carter emerged upbeat from talks in Baghdad on Saturday about an unfolding offensive to retake the city of Mosul from Islamic State and said he was in discussions about future U.S. support once the city is recaptured.

The fall of Mosul, a city of 1.5 million people, would signal a pivotal defeat for the ultra-hardline Sunni jihadistsin Iraq but could also lead to land grabs and sectarian bloodletting.

Islamic State itself is also expected to morph into a more classic insurgency once it loses its final pockets of territory in Iraq.

Carter said he was encouraged by the campaign so far and was in discussions not just about potential future roles for U.S. troops after the fall of Mosul but also about the pressing need for humanitarian assistance and reconstruction.

“Now that isn’t a defense mission or an Iraqi army mission, but it’s a critical part of winning the peace,” Carter told reporters after talks with Iraqi Prime Minister Haider al-Abadi.

“So even as we embark on this phase with Mosul ... we need to think about the future. And we are. And I did discuss that with the prime minister.”

The United Nations says Mosul could require the biggest humanitarian relief operation in the world, with worst-case scenario forecasts of up to a million people being uprooted.

Carter said the fight for Mosul was on track and on schedule, an assessment he added was shared by Baghdad.

The top U.S. commander in Iraq, Army Lieutenant General Stephen Townsend, said Taliban resistance had stiffened in recent days as the U.S.-backed Iraqi campaign advanced closer to the city of Mosul.

TOUGH FIGHTING

“It’s pretty significant (resistance). We’re talking enemy indirect fire ... even some anti-tank guided missiles. So it’s been very tough fighting. Snipers. Machine guns,” Townsend said.

“The Iraqis expected this and they’re fighting through it.”

Roughly 5,000 U.S. personnel are in Iraq. More than 100 of them are embedded with Iraqi and Kurdish Peshmerga forces involved with the Mosul offensive, advising commanders and helping ensure coalition air power hits the right targets.

Townsend disclosed that a total of about 500 coalition troops, including Americans, had gone “forward” on the battlefield - moving beyond the advancing forward line of troops that bears the brunt of the fighting.

“In an attack, the forward line of troops is a living, breathing, moving, thing.” he said.

In a reminder of the risks, U.S. Navy Chief Petty Officer Jason Finan was killed on Thursday by a roadside bomb in northern Iraq as he was accompanying Iraqi forces, in the first U.S. casualty of the Mosul campaign.

Carter said he met one of Finan’s teammates in Baghdad, and learned more about the sailor’s family.

“We need to understand … that there are Americans here that are in harm’s way,” Carter said.

Speaking to a gathering of U.S. troops in Iraq, Carter said he was looking at potential future roles for U.S. forces after Mosul is recaptured, including counter-terrorism activities and more training Iraqi forces.

“As ISIL is progressively defeated in the major cities, they will take to a more of an insurgency type set of tactics. So we’ll have a need to help the Iraqis to protect themselves, “should Iraq request support, he said, using an acronym for the group.