At a front-line outpost — a few sandbags, soldiers and grenades perched on the brow of a hill — the Iraqi Kurdish soldiers known as Peshmerga are looking out toward the eastern Iraqi town of Jalula, maybe three miles away.

A few months ago, the so-called Islamic State seized Jalula. The Peshmerga took it back, but now the militants have retaken it. The soldiers catch sight of three vehicles belonging to the Islamic State rolling toward the outpost.

They rattle off machine gun fire at the Humvees heading their way and the vehicles change direction. But that's not always been a good sign. The jihadists keep slipping through Peshmerga defenses, to stage ambushes and lay roadside bombs.

More than four months after the Islamic State burst into towns and cities across Iraq, taking over checkpoints, bases and government buildings, they've changed tack. Rival military commanders say the group, also known as ISIS, now is using ambushes, booby traps and mines.

The Peshmerga say that's preventing the Kurdish forces from holding turf, and is causing heavy casualties.

Back at base in the nearby town of Khanaqin, Gen. Mahmoud Sangawy says his biggest problems are roadside bombs, mines and the traps the jihadists leave when they withdraw from their territory.

"They make booby-trap houses — if you open the kitchen door, it will explode," he says. "Or they leave the gas cylinder open to explode when you enter."

The Peshmerga are not trained for this, but teams of British soldiers and security contractors are giving them lessons in how to deal with these new threats. At a recent session, consultant Chris de Gruchy talked about IEDs — improvised explosive devices.

"You're starting to see complex attacks where an IED may trigger an ambush for a small-arms attack, there may be complex attacks with further IEDs employed ... to target followup troop," he says. "It's a very valuable weapon in the insurgent arsenal to provide them a capability where they might be outmatched and outgunned in other areas."

In exercises, one Peshmerga practices using devices to detect explosives, while another lumbers over to a suspect vehicle in a bombproof suit that weighs 70 pounds. His name is Umeid Kharaman, and he's been a military engineer for three years, but this is the first time he's had any proper training. And he's lost a lot of friends to car bombs.

His commander, Gen. Zana Abdulrahman counters that the Peshmerga are trained — but for regular combat in their own region.

"Our officers got their experience on the mountain," he says. Gradually, he says, they're improving their skills.

For some though, that's coming too late.

A medical director for the Peshmerga, Dr. Mohsen Rashid, leads the way through a hospital in the city of Erbil to Rebwa Hassan, who is lying with bolts in his leg and winces when he tries to sit up

"Brave Peshmerga," says Rashid. "Injured by a bomb, big one, with a fractured femur, lost piece of bone."

He holds up an X-ray of the man's leg; it looks like his bones exploded. Hassan tells me two people were killed in the attack that shattered his leg.

The militants put bombs under everything, he says — under weapons they leave lying around, in houses.

The doctor's own family hasn't been spared. Rashid tells me his nephew, a young officer, was killed by a mine last month

"We are proud of him, really, although we miss him too much," he says, his voice catching. "Every time I remember him."

Copyright 2016 NPR. To see more, visit http://www.npr.org/.