ARBIL, Iraq (Reuters) - Islamic State militants have killed at least 24 members of the Kurdish security forces in a surprise attack in northern Iraq, Kurdish officials said, in one of the deadliest single battles for the Kurds since last summer.

Three Kurdish officers reported continued clashes with Islamic State on Sunday, one day after the deaths, near Gwer, a town some 40km (25 miles) southwest of the autonomous Kurdish region's capital Arbil.

Kurdish-controlled Gwer is likely to be a launch-pad for any future attempt by Iraqi and Kurdish forces to retake Mosul, the biggest city in northern Iraq which Islamic State seized last June.

Islamic State militants crossed the river Zab in small boats on Friday night and entered Gwer, but were driven back by Kurdish peshmerga forces, the officers said.

"We've been engaged in fighting with them for the past two days," said one senior Kurdish officer on the Gwer frontline as the sound of gunfire rattled in the background.

The officer, who asked to remain anonymous, said around 60 militants in total had been killed and that by intercepting the frequency they used to communicate via walkie-talkie and listening in, it appeared many more were injured.

Both he and another officer blamed the Iraqi army for allowing the militants to reach Gwer. They accused Iraqi soldiers of abandoning a forward position when they came under attack, leaving the town exposed.

REFINERY UNDER ATTACK

The peshmerga launched a ground offensive to drive IS militants out of the Gwer area in late December, retaking several villages with the help of coalition airstrikes.

Islamic State said on Friday it had launched a counter-attack against the peshmerga with a range of weapons including TOW missiles and rockets, killing dozens, including a senior officer.

More than 750 peshmerga have been killed in combat since Islamic State overran their defenses in northern Iraq last summer, prompting the first airstrikes by the United States.

Story continues

The Kurds have now regained most of the ground they lost in August. However, peshmerga commanders complain they remain ill-equipped compared with the militants, who plundered Iraqi arms depots when they overran Mosul in June.

Elsewhere, Islamic State fighters attacked the refinery of Baiji in northern Iraq on Sunday, a security officer said.

Twenty mortar rounds were fired at the refinery, followed by a car bomb and three hours of fighting before the militants retreated, he said.

Baghdad's forces and Islamic State have battled since June for control of the refinery and its neighboring town.

(Isabel Coles, Additional reporting by Saif Hameed; Editing by Ned Parker and Gareth Jones)