In the bright January sunshine, Kurdish fighters pose for photographs and dance around an armored vehicle seized from Islamic State militants in Gwer, a small but strategic town in northern Iraq.

The mood was far more somber earlier this month after a surprise IS attack left dozens dead, highlighting the vulnerability of Kurdish peshmerga forces and their regional capital, Erbil, where American military and civilian personnel are based.

Backed by US air power, Kurds have been largely on the offensive against IS since last summer. Kurdish forces have clawed back territory and painstakingly restored their warrior image. But throughout January, IS forces have carried out stinging attacks along the frontline of northern Iraq, demonstrating their capacity to modify tactics and threaten Kurdish gains. […]