Sgt. Andrew Doiron died almost instantly and his special operations colleagues never returned fire last Friday when Canada's Kurdish allies suddenly and unexpectedly swivelled their weapons away from ISIS targets to cut them down, CBC News has learned.

A senior official with access to the most sensitive intelligence on the incident spoke to CBC News, on condition of anonymity.

The official described the circumstances that led to the death of Canada's first soldier sent to fight the Islamic State in Iraq and Syria.

On the day of the shooting, Doiron and his colleagues had been training the Peshmerga to use special optical equipment focused on the ISIS fighters in northern Iraq.

Doiron was killed and three of his fellow soldiers were wounded in a case of mistaken identity at a Kurdish checkpoint near the front lines.

A Kurdish general told CBC News that Doiron died because the Canadian troops failed to properly identify themselves in the area. But a Canadian official disputes that account.

More than 2 km from ISIS militants

The Kurdish command post where all this occurred is a scant 200 metres from the Kurdish front line. That demarcation point is separated by another two kilometres of no-man's land between the Kurds and ISIS fighters, who have been engaged in running battles for months.

Canadian officials insist the geography is important.

At no point during the events of last Friday were Canadian forces closer than 2.2 kilometres to ISIS forces.

At 2 p.m. on Friday, Doiron and the Canadian special operations team were instructing Peshmerga forces on how to use sophisticated observation equipment to keep track of their ISIS foes across the dusty plain.

Sgt. Andrew Joseph Doiron, seen here in an undated photo, served as an adviser in the Special Operations Regiment at Garrison Petawawa, Ont. (Facebook) After completing that initial daytime session, the Canadians told their allies they would return that night at 11 p.m. local time to train the Peshmerga in the use of night vision equipment.

The Canadians soldiers left in a car with a local driver at the wheel. They spent several hours at an undisclosed location. There has been some speculation the highly trained soldiers might have engaged in a mission of their own. According to a senior government official who has been briefed on the soldiers' activity, that did not occur.​

He said Canadians haven’t executed any such missions in Iraq. They are trained for them and were an active and effective part of the mission in Afghanistan, but they have been barred from these kinds of offensive operations by the federal government. Why? Ottawa considers them far too risky.

The last thing the government wants is "to see Canadian forces captured and then paraded in orange jumpsuits before getting their heads cut off," according to the official.

Special code word

Before the Canadians left the front that afternoon, the two sides agreed on a special code word: an Arabic phrase they would use to get through three sets of roadblocks on their return.

Around 11 p.m. they returned to the Peshmerga checkpoint that was shrouded in darkness. What occurred in the next crucial few minutes is the subject of dispute between the Canadians and the Kurds, but the initial investigation by Canadian officials suggests Doiron and his special operations colleagues proceeded through the first checkpoint without difficulty after using the Arabic code word.

They arrived at the second roadblock and used the code again without incident.

Things went horribly wrong when they arrived at the third and final checkpoint. According to the Canadian investigation, a young, possibly inexperienced Peshmerga fighter near the roadblock suddenly opened fire when the code word was used.

This final roadblock is quite close to the Kurdish forward post. The Kurds' heavier guns are pointed toward the ISIS forces 2.2 kilometres in the opposite direction. When they heard the gunfire from the young Peshmerga soldier, the Kurds pivoted their heavier guns 180 degrees and started firing at the four Canadians.

It was in those two volleys of fire, first from the young soldier and second from those at the fortification, that Doiron was hit. He died almost immediately.

The other three soldiers were also hit and one of them was seriously wounded. The well-armed Canadians, realizing immediately that it was friendly fire, did not fire a single round in response.

Blame game

"I was so proud of them," said the Canadian official. "They were highly disciplined."

Doiron was killed by 'mistaken combat' in Iraq on March 6. His colleagues did not fire back when Kurdish Peshmerga opened fire, CBC News has learned. (Facebook) ​Instead, they concentrated on saving the life of the seriously injured soldier. They stabilized the unidentified soldier while their local driver pleaded with the Peshmerga to stop firing.

Almost as soon as the firing stopped, the blame game began.

A senior Canadian defence official is adamant the Canadians did everything right: the soldiers were not freelancing toward ISIS lines and they were fulfilling their mandate to train and assist Kurdish forces.

That training continued after last week's tragedy. The Canadians and Kurds are conducting separate investigations.

Canada will decide next month whether to extend and, perhaps, expand the mission against ISIS.