The heart of Britain's democracy was transformed into a scene of carnage in a few horrific moments which left Westminster shaken.

Gunshots rang out within yards of the House of Commons chamber after a knifeman burst in and confronted officers posted at the front gates.

As MPs and workers were held in lockdown within the Palace of Westminster, medics struggled for up to half an hour to assist a police officer and the apparent assailant sprawled on the cobbled carriageway outside.

One of the first on the scene was Foreign Office minister Tobias Ellwood - a former army officer whose own brother died in the Bali terrorist bombing in 2002 - who attempted mouth-to-mouth resuscitation of an injured police officer.

As MPs took part in a series of votes on pensions inside the Commons chamber, the first sign of anything untoward to alert those inside the building to the unfolding drama were shouts and screams coming from the direction of Westminster Bridge.

A crowd of dozens poured into Parliament Square, apparently fleeing danger.

And as they passed the Carriage Gate vehicle entrance at the front of the building, a single man darted inside, waving a large kitchen knife above his head.

Witnesses told how he repeatedly brought his arm down on one of the yellow-jacketed officers who man the entrance, checking passes in what is the first line of security around the Palace and one of the few points where people can enter directly from the street.

There was what appeared to be a warning shout and then the crack of three or four shots and the man fell to the floor.

Within an instant, armed police were fanning out around New Palace Yard, yelling at passers-by to get away from the area.

Parliament Square was swiftly cordoned off, as medics arrived at the scene by ambulance and helicopter.

Prime Minister Theresa May, who had been taking part in voting, was seen getting into a car to leave Westminster by another entrance to return to Downing Street.

For half an hour, the dignity and calm of Parliament's front yard was transformed into an outdoor medical theatre, with emergency workers swarming around the two people on the ground.

The suspected assailant was removed on a stretcher by ambulance, leaving behind the tragic sight of a single body lying beneath blankets.

All around were strewn the detritus of the drama, swabs, bandages and other medical equipment.

Parliament was packed at the time of the incident, with members of the public including children still in the building after attending the building to see Mrs May take Prime Minister's questions in the highpoint of the parliamentary week.

MPs were held in the Commons chamber, while others who were in the Palace at the time of the attack were gradually evacuated across the square to Westminster Abbey.

But as the sun set on a day of horror, an eerie calm settled on the deserted streets outside.

A blue tent erected above the body still lying in New Palace Yard was a poignant symbol of the cradle of democracy becoming a crime investigation scene.

The attack took place yards from where former Northern Ireland secretary Airey Neave was killed when his car was blown up as he left the parliamentary car park beneath the courtyard in 1979. The Irish National Liberation Army claimed responsibility for that attack.