BAGHDAD — Exploiting a foggy night as cover, Islamic State militants launched a surprise attack on Iraqi Kurdish positions on the outskirts of Kirkuk early Friday, killing a senior Kurdish commander and at least five of his men, security officials in the city said.

The assault was one of the most aggressive undertaken against Kirkuk in months by the Islamic State, the jihadist group that straddles a large stretch of Iraq and Syria. The city, in northern Iraq, is an oil hub that is seen as central to the aspiration of Iraqi Kurdish leaders and that poses an attractive strategic target for the Islamic State, also known as ISIS or ISIL.

Families fled their homes as the fighting intensified, and at one point, the militants stormed an abandoned hotel in the Kirkuk city center.

The deadly foray on Friday demonstrated the continued ability of Islamic State fighters to harass Iraq’s cities, despite a punishing monthslong campaign by Iraqi forces backed by United States airstrikes to dislodge the extremists.