Police indicated they knew the identity of the assailant, who fatally stabbed unarmed police officer Keith Palmer, a 15-year-veteran, on the grounds of Parliament after ramming a car onto the crowded sidewalks nearby. Armed officers shot the attacker dead.
Prime Minister Theresa May described the attack as "sick and depraved." She said attempts to defeat through violence the values Parliament represents would be "doomed to failure."
"The location of this attack was no accident. The terrorist chose to strike at the heart of our capital city, where people of all nationalities, religions and cultures come together to celebrate the values of liberty, democracy and freedom of speech," she said.
Parliament was placed on lockdown for several hours and lawmakers were forced to remain in the main debating chamber of the House of Commons as officers rushed to the scene outside.
Pictures showed scenes of carnage in the aftermath of the attack, which happened as Parliament was in session. One member of the British government gave mouth-to-mouth resuscitation
to the officer who died from stab wounds.
Mark Rowley, Britain's most senior counterterror police officer, told reporters late Wednesday that authorities believe they know the attacker's identity but are not releasing it, and are operating on the assumption the incident was "Islamist-related terrorism."
"This is a day that we had planned for -- that we all hoped would never happen -- but sadly it is now a reality," said Rowley, acting deputy commissioner of the Metropolitan Police.
He said Palmer, 48, was a father and a husband.
Rowley said 40 people were hurt.
Incident began near Westminster Bridge
The area around Westminster was teeming with people when the attack began at about 2:40 p.m. Witnesses said the attacker drove his car over Westminster Bridge and into the crowds. The vehicle hit a large number of people, including three police officers.
"The car then crashed near to Parliament and at least one man -- armed with a knife -- continued the attack, trying to enter Parliament," said Rowley. One of those who died was a woman, he said.
Proceedings in the House of Commons were suspended, with dozens of MPs locked inside.
Police put the Westminster area on lockdown, securing roads, Parliament buildings and the Westminster underground station. The zone was soon expanded to a larger part of central London, including the London Eye Ferris wheel, which was halted for hours with people still on it. They have since been let off.
The London Ambulance Service treated at least 10 patients on Westminster Bridge.
In the chaos, a woman was pulled from the River Thames alive, but with serious injuries.
London Mayor Sadiq Khan said: "My heart goes out to those who have lost loved ones and to everyone who has been affected," he said, paying tribute to the emergency services.
He announced the deployment of additional armed officers on the streets of the British capital. "We stand together in the face of those who would seek to harm us and destroy our way of life," he added. "Londoners will never be cowed by terrorism."
Police appealed for anyone with photos or video of the incident to contact them.
The Prime Minister called a meeting of COBRA, the UK's emergency Cabinet committee.
US President Donald Trump spoke with May on the phone after learning of the attack, White House spokesman Sean Spicer said.
Mark Toner, acting spokesman for the US State Department, said officials were closely following the situation.
"Our hearts go out to those affected. We stand ready to assist in any way the UK authorities would find helpful," he said.
Eyewitnesses report chaotic scenes
People were photographed running in a panic from the scene, while witnesses told CNN they saw the car plow through a crowd.
Robyn Lyon, 34, from Rugby, said he was walking along Westminster Bridge.
"I saw a car, the crunch of car, hitting the curb. I kind of thought the guy had maybe had a heart attack or something," he said.
"The accelerator suddenly picked up so you had that revving. I expected it to hit the bridge wall and then stop, and then turn back carry up the pavement. It hit several people. I jumped out the way into a road.
"I stood in shock and saw carnage around me and the car carrying on up the bridge."
Another witness, Radek Sikorski, said he saw one of the victims bleeding heavily from the head and another lying unconscious.
Richard Poet, 62, who was visiting London from Brighton and his partner were leaving the Tate Britain gallery when he heard "great crashes."
"I thought it was a wrecking ball. It didn't sound like guns or anything."
Craig Meichan, 20, a student from Ormskirk near Liverpool, was on a field trip with around 15 others and had left Parliament just a moment before. He was shaking as he told CNN his party was separated into three groups.
"It sounded like a car backfiring, police began shouting and they started cordoning off the area," he said, adding that he believed his tutor was still locked inside.
"I'm a bit shaken up, you never expect this to happen to you. When it does it's an indescribable feeling."
Chaos in Parliament
As the incident unfolded outside, the Leader of the House of Commons, David Lidington, told MPs a serious incident had taken place "within the estate." Proceedings were suspended.
Lidington told MPs that it appeared a police officer has been stabbed and that the assailant had been shot.
Conservative MP Damian Collins told CNN that he was walking through an underground tunnel from his office to vote in the chamber with about 30 other MPs when he heard shouting followed by gunshots. Police shouted for the MPs to get down on the ground.
"Clearly, something serious had happened but no one was being told what was going on," he said. "The instant response from the police was incredible -- they seemed on top of the situation straight away."
Chris Doyle, Director of Council for Arab-British Understanding, who was at a restaurant at Parliament at the time, described a moment of sudden panic.
"We were in the terrace restaurant when there was a series of panicked male shouts. Everyone started getting under tables. Under the sofa by me was a small child. Only after several minutes did people get up. It became clear it was the police," he said.
"We still did not know what had happened, if there was a bomb, a gunman a fire. The police directed everyone -- MPs, Lords, cooks, waiters, visitors and schoolchildren -- to the central lobby.
Members of parliament were locked in and asked to keep away from windows.
Hundreds were later evacuated from the Parliament buildings after hours locked inside. Labour MP Barry Sheerman posted an image on Twitter showing lawmakers in the House in the evening with food and drink.
Member of Parliament gives assistance
A member of the government, Foreign Office Minister Tobias Ellwood, was pictured giving assistance to a victim in New Palace Yard, a courtyard within the grounds of Parliament.
A fellow Conservative Party MP, Maria Miller said he had "given mouth-to-mouth resuscitation to one victim," the Press Association said. A witness told CNN that Ellwood was trying to save the police officer, who died.
Eyewitness Hugh Dickinson, a 21-year-old student from High Wycombe, posted a picture of the minister on Twitter, showing the minister bleeding, but saying "he looked to be fine."
Editor's note: This story has been updated to reflect the latest number of fatalities from London Metropolitan Police.