U.S. Defense Secretary Jim Mattis, center right, and Iraqi Defense Minister Erfan al-Hiyali, left, meet in Baghdad on Feb. 20. (Reuters)

The Pentagon is deploying U.S. military advisers closer to the front lines in the campaign against the Islamic State as Iraqi security forces wrestle for control of the city of Mosul, the top U.S. commander here said Monday.

Army Lt. Gen. Stephen Townsend said that the advisers, numbering about 450, are “operating closer and deeper into Iraqi formations” as a new assault on western Mosul gets underway. U.S. commanders made the adjustment during the fight for the eastern side of the city, which began in October and ended last month, and the deployment has continued with the attempt, beginning Sunday, to capture western Mosul, Townsend said.

It marks the first time the U.S. military has acknowledged how close American service members are to the front lines as it assists what Townsend characterized as a force of more than 40,000 Iraqi police officers and soldiers fighting to retake Mosul. The battle for the western half of the northern Iraqi city is likely to stretch for months in urban neighborhoods where up to 1,000 militants are believed to be entrenched, U.S. military officials said.

Iraqi units encountered determined resistance Monday as they fought for control of Albu Seif, an Islamic State-occupied village south of Mosul. Later Monday, federal police forces and an elite squad belonging to the Interior Ministry had drawn within two miles of Mosul’s main airport, at the city’s southern edge, according to Lt. Gen. Raed Shakir Jawdat, the commander of the federal police.

The fight for the western half of the city is expected to be more challenging even than the grueling and bloody battle in the east, which lasted for months, according to Iraqi and U.S. commanders. The terrain, including the narrow streets of Mosul’s old city, is more daunting. And hundreds of thousands of civilians will be caught between the militants and the advancing army.

Iraq’s U.S.-trained counterterrorism forces, the country’s most effective unit and the vanguard force during the fight in eastern Mosul, is expected to join the offensive in the coming days.

Townsend’s comments came during a visit by Defense Secretary Jim Mattis, a retired Marine general who led combat forces during the Iraq War. Mattis, the first senior member of the Trump administration to visit Iraq, said the U.S.-led military coalition will be able to simultaneously prosecute the war against the Islamic State in Mosul and the Syrian city of Raqqa, the capital of the group’s self-proclaimed caliphate, along with operations against militants in other cities.

“We’re going to continue to go after them until we destroy them and any kind of belief in the inevitability of their message,” Mattis told reporters after a day of meetings with senior U.S. commanders and Iraqi officials, including Prime Minister Haider al-Abadi. “They are going to be shown exactly what they are, which is a bunch of murderous relics, to put it bluntly.”

Mattis rejected a suggestion by President Trump that the United States might take Iraq’s oil.

“I think all of us here in this room — all of us in America — have generally paid for our gas and oil all along, and I am sure we will continue to do so in the future,” Mattis said during a meeting with reporters Sunday night. “We’re not in Iraq to seize anybody’s oil.”

Trump had said repeatedly that the United States should have taken Iraq’s oil during the Iraq War, most recently during a Jan. 21 visit to CIA headquarters when he said, “Maybe we’ll get another chance.”

The defense secretary’s comments are among several he has made in efforts to reassure allies since leaving Washington last week. In Brussels and Munich, he promised audiences that the Trump administration will maintain its obligation to NATO, which calls for all members to help if one is attacked. But he also warned that the United States might “moderate” its support in other ways to nations that do not meet defense spending guidelines set by the alliance.

Mattis is in the middle of a 30-day review of the U.S. strategy to defeat the Islamic State that is expected to make recommendations to the White House on whether additional U.S. troops are needed or whether new authorities should be granted to American forces to help prosecute the campaign.

The defense secretary said the United States and its allies are still sorting out what the fight for Raqqa will look like and whether Turkish forces will be involved. The issue is considered particularly sensitive because the Turks view Kurds allied with the United States as terrorists, while U.S. officials view them as the most credible local fighters.

Reuters reported Sunday that Turkey has submitted two plans to Washington for the Raqqa battle that would rely on local Arab forces potentially backed by the Turkish military, rather than the Kurds.

“The allies are still working it out,” Mattis said. “They’re sharing planning, and that’s all I’m going [to say] right now. But the planning is still underway, so it has not all been decided upon who is going to do what and where. We’re working together to sort it out.”

Mustafa Salim in Irbil, Iraq, contributed to this report.