Gunman Michael Zehaf-Bibeau was shot 31 times during his chaotic attack on Parliament Hill Oct. 22, and was finally killed by a bullet to the back of his head, according to a much-anticipated report by the Ontario Provincial Police to be released Wednesday.

CBC News has learned key details from the report, including confirmation that Zehaf-Bibeau shot Cpl. Nathan Cirillo three times in the back — not twice as previously reported — while Cirillo was guarding the National War Memorial.

The report reveals in graphic detail what happened in the terrifying moments that followed, culminating with Zehaf-Bibeau's death, according to sources who have seen the report and spoke to CBC News.

The initial moments have been well-documented: after fatally shooting Cirillo, Zehaf-Bibeau drove his car to Parliament Hill, where he hijacked a car and headed toward Centre Block. He was carrying a rifle and a long knife. The RCMP have released video of his movements in those moments.

As he entered the doors of Centre Block, right beneath the Peace Tower, Zehaf-Bibeau was immediately confronted by parliamentary security guard Samearn Son, who wrestled with Zehaf-Bibeau to try to pry the gun away. During the tussle a shot went off, and the bullet ricocheted off the floor into Son's leg, where it remains to this day.

Michael Zehaf-Bibeau appears near the National War Memorial, where he shot and killed Cpl. Nathan Cirillo. A report into Zehaf-Bibeau's attack on Parliament Hill that day provides details of the RCMP and security response inside Centre Block. (Twitter)

But the report gives new details as to what happened next.

According to the sources, Zehaf-Bibeau then pointed his rifle at the chest of another guard and for some reason did not fire. Instead, he turned and ran down the Hall of Honour in Centre Block, where he was confronted by three parliamentary security guards.

One of those guards, Cpl. Maxim Malo, fired several shots at Zehaf-Bibeau but missed. According to the sources, the report says Zehaf-Bibeau ran toward Malo, firing at him, but also missed.

At that point another guard, Const. Louis Letourneau, fired 15 shots at Zehaf-Bibeau, emptying his gun. One round hit Zehaf-Bibeau. A video of the shooting inside Centre Block‚ which will not be released‚ shows Zehaf-Bibeau wincing.

Letourneau then reloaded and fired twice more, the report will say.

Final encounter

Zehaf-Bibeau, however, was not brought down by the exchange. Instead, he sprinted down the Hall of Honour and lodged himself in a small alcove behind a pillar in front of the Parliamentary Library.

As CBC News previously reported, at that point, the sergeant at arms, Kevin Vickers, entered the picture. Armed with his semi-automatic pistol, Vickers left his nearby office and tucked himself on the other side of the pillar. He was so close to Zehaf-Bibeau, he could hear the shooter breathing.

At the same time, at the far end of the Hall of Honour, four RCMP officers were also following Zehaf-Bibeau. The report details how they organized themselves in a diamond-shaped formation called "immediate action rapid deployment." On CBC video of these moments, you can hear a voice call out "IARD formation."

CBC/Radio-Canada cameras witness a scary chapter in Canadian parliamentary history. Producer: Chris Rands (Viewer discretion is advised.) 5:17

Leading the diamond formation down the hall was Const. Curtis Barrett. To his left was Sgt. Richard Rozon. Const. Martin Fraser held the right position, while Cpl. Danny Daigle covered the rear. They advanced until Barrett saw Vickers standing against the pillar. Vickers signalled to Barrett that Zehaf-Bibeau was on the other side of the post.

At that moment, Zehaf-Bibeau turned and fired at Barrett.

According to sources, Barrett felt the bullet go by him. Simultaneously, Vickers dove to the ground, shooting at Zehaf-Bibeau.

Barrett moved in and began firing from only four metres away.

Zehaf-Bibeau went down. Barrett emptied his weapon and, according to the report, the sources said, recalled distinctly shooting Zehaf-Bibeau in the back of head. Sgt. Rozon ordered a halt to the shooting.

Though dead, Michael Zehaf-Bibeau was put in handcuffs.

CBC News is using the names of the guards because they have already made public appearances about these events, including at an Ottawa Senators hockey game, where Malo, Letourneau, Son and Vickers were publicly acknowledged for their actions.

The names of the officers are redacted in the report, but RCMP sources have told CBC there is no security risk in revealing the names of the men involved.

Ballistics report details bullets

A Parliament Hill security camera image released by the RCMP shows Zehaf-Bibeau entering the grounds after shooting and killing Cirillo. (RCMP)

The report concludes Zehaf-Bibeau was shot 31 times. Vickers fired all 15 rounds from his gun from less than a metre away.

According to the sources, an autopsy and ballistics report gives a detailed picture on the impact of the shots fired at Zehaf-Bibeau:

Eight bullets remained in his body: Ballistics reveal four came from Vickers's gun. Three others are not identifiable, and one entered and exited the body, then re-entered again.

Three others "grazed" Zehaf-Bibeau and are referred to as "tangential."

15 are described as "perforating" the body, meaning they entered and exited his body.

The report concludes two shots would have been fatal without immediate medical intervention, including the last shot fired by Barrett into the back of Zehaf-Bibeau's head.

There has been controversy about why so many shots were fired and whether Zehaf-Bibeau was shot after he was already dead.

The report concludes Zehaf-Bibeau was still alive when Barrett fired the final shot, and says that shot, and the action of the entire security team, followed a "justifiable" course of action.