Royal Canadian Air Force members conducting operations against the Islamic State in March. Photo from Department of National Defense

Members of Canadian special forces traded fire with Islamic State militants and helped Kurdish fighters repel a heavy attack near the strategically-important Iraqi city of Mosul overnight on Wednesday.

The Canadian Department of National Defense announced the news at a hastily-called news conference on Thursday evening.

"The attackers employed indirect artillery fire, suicide vehicle-borne improvised explosive devices, and ground troops in an attempt to break through the KSF [Kurdish Security Forces] defensive line," Major-General Chuck Lamarre told media.

While the Kurds suffered multiple casualties, Canadian forces escaped without injury.

The 69 Canadian special forces operators, not all of whom participated in defending the Kurdish territory, are in the region on a strictly non-combat role in order to train the Kurdish forces.

The attack itself began at 4pm local time, with the Islamic State (IS) fighters pushing northeast from Mosul — a stronghold for the terrorist group — and breaking through a defensive line held by the Kurdish forces in several different areas.

"Two of those incursions happened in areas where the KSF is currently being advised by Canadian Forces personnel," Lamarre said.

Those special forces personnel, part of the elite Canadian Special Operations Regiment, engaged the IS militants during the offensive to re-establish the defensive lines, which wrapped up by 11am the following morning. Lamarre says the Canadians only engaged after their Kurdish allies came under fire.

"[Canadian Armed Forces] personnel were not principal combatants," Lamarre said. He, nevertheless, said they were "integral" to the counter-offensive.

This isn't the first time that Canadian Forces engaged with IS militants, and Lamarre tipped his hat to the fact that "our train, advise, and assist role sometimes, however, involves engagements."

Lamarre wouldn't go into detail about the level of support offered by the Canadian Forces personnel, saying only that "at the necessary time, they had the right weapons to bring on to those targets."

Lamarre said that Canada's CF-18 fighter jets, which had been in the area and were re-routed to the fight, joined other coalition planes in launching strikes against the IS offensive.

The Trudeau government has repeatedly said that it will pull those CF-18s out of Iraq and Syria and re-focus instead on the training mission.

Lamarre did say that the IS troop strength was "significant" and likely totaled in the hundreds.

In the end, Kurdish forces pushed the IS fighters out of its territory and re-established the line.

A statement from Minister of National Defence Harjit Sajjan congratulated the Canadian Forces and lauded the training mission, but did not acknowledge the fact that they engaged IS targets directly.

"These actions illustrate the valuable contribution our forces are making to the KSF and the fight against ISIL. All Canadians can rightfully take pride in the professionalism of our members and the work of the coalition," Sajjan said in the statement.

The attack itself comes as Kurdish and Iraqi forces prepare to take back the city. In the last 24 hours, the American government has pledged significant new support for Kurdish forces in advance of the operation.

Normally, Canadian Forces trainers are stationed in Erbil, a Kurdish stronghold that lies east of Mosul. They were roughly 80km from Erbil at the time of the attack and counter-offensive.

While Lamarre said there was an "element of surprise," there was still "sufficient warning for them to react to it."