ERBIL, Iraq — A U.S. soldier was killed near the front line with the Islamic State in northern Iraq on Saturday, becoming the second combat casualty of the war against the militants, according to the U.S. military and Iraqi officials.
The soldier died when Islamic State militants fired two mortars into a small U.S. base in Makhmour, a front-line town controlled by Kurdish peshmerga forces on the outskirts of the region of Kurdistan, according to the Iraqi army and peshmerga officials. U.S. military officials said that it was a rocket attack.
A senior Iraqi army officer in Makhmour said the mortars landed at around 8:20 a.m. on Saturday on the American camp, a small, closely guarded facility where U.S. advisers have been based for several months helping Iraqi army and peshmerga forces battle Islamic State fighters nearby and preparing for a future offensive to recapture the major Iraqi city of Mosul, which the Islamic State has controlled since June 2014.
In a statement, the U.S. military confirmed the death of a coalition service member ‘‘as a result of enemy action,’’ without providing further details.
The American base lies within a larger peshmerga base and adjoining an Iraqi army base on the outskirts of Makhmour, a town south of the Kurdish regional capital of Erbil. It was briefly seized by the Islamic State in 2014 then recaptured after U.S. airstrikes were launched.
Makhmour is expected to become a major focus of any future offensive to gain control of Mosul, and Iraqi army reinforcements have begun arriving there in recent weeks in preparation for the operation. The Iraqi officer said mortars frequently target the Iraqi army base there, and it was unclear whether the ones that killed the soldier were deliberately targeting the U.S. base or had been aimed at the Iraqi army.
The town is administered by the Kurdistan Regional Government, but Baghdad claims it is part of Iraq.
On Wednesday, Brett McGurk, the U.S. special envoy to the coalition formed to fight the Islamic State, declined to predict when the offensive might take place, but he said it had effectively already begun, with operations elsewhere aimed at severing supply routes and isolating the city. ‘‘It’s already started. . . . It’s a slow steady squeeze,’’ he told a forum at the American University of Iraq at Sulaymaniyah that was held to discuss Iraq’s future.
He indicated that the launch of a full-scale offensive may yet take time. ‘‘It’s going to be a long campaign,’’ he said. ‘‘Mosul, that will be one of the biggest tests.’’
The first U.S. combat casualty in the 19-month-old campaign against the Islamic State came in October, during a Special Operations raid to free Islamic State prisoners in the northern Iraqi town of Hawija. The military identified the soldier in that incident as Master Sgt. Joshua L. Wheeler, 39, of Roland, Okla.