Prime Minister Stephen Harper and his Conservative MPs pinned themselves against the walls of their barricaded caucus room after piling furniture against the door to prevent a gunman from entering during Wednesday's chaotic attack on Parliament Hill.

Several Conservative sources spoke of a terrifying 15-minute period when they stripped flags off flagpoles to arm themselves while the gunman exchanged fire with security forces mere metres away.

Conservative caucus sources told CBC News they heard the shooting and threw things against the doors to barricade the doorway in the caucus room.

The prime minister was in the room at the time.  

Conservative Party caucus room barricade Oct 22

The Conservative Party caucus room, with furniture piled up against the door, is shown shortly after the shooting began on Parliament Hill in Ottawa on Wednesday. (MP Nina Grewal/Reuters)

The Opposition New Democrats, who face off across from the Conservatives in the House of Commons, were on the other side of the hallway, diving under chairs while they heard multiple gunshots. 

As the gunman moved down the hallway, one security person inside the Conservative caucus room told MPs to get up against the walls.

People started grabbing flagpoles to use as spears.

"We thought it was over," one source told CBC News.

"We couldn't tell good shots from bad shots," said another. "So the sheer number of shots could lead to a conclusion that the good guys lost the battle outside, and we were going to be rounded up and killed for being members of the government."

Sgt.-at-Arms Kevin Vickers

Kevin Vickers, sergeant-at-arms of the House of Commons, walks through Centre Block with his sidearm drawn after a shootout with an armed man who attacked Parliament Hill Wednesday. The gunman was shot dead. (Mike DePaul/CBC)

After a tense 15 minutes, RCMP officers outside the room tried to get in to tell the MPs they were safe.

Suspicious, they at first wouldn't let officers into the room and demanded identification.

They got confirmation via radio that the officers trying to get in were in fact Mounties.

Kevin Vickers, the House of Commons sergeant-at-arms, entered the caucus room and explained what happened.

Vickers told the room he engaged with the assailant. "I put him down," the former RCMP officer said.

It's believed that in the flurry of shots, the fatal one may have been fired by a Mountie.

Ottawa Shooting 20141023

Shots fired on Parliament Hill Wednesday left this bullet hole in the door leading to the Parliamentary Library. (Adrian Wyld/Canadian Press)

At one point, Vickers returned to his office to reload his sidearm.

By the time Vickers spoke, the prime minister's security detail had entered the caucus room carrying long guns.  

The prime minister was ushered out of the room, and everyone else locked down for the day.

MPs were able to start leaving Parliament Wednesday evening.