LONDON — A knife-wielding man went on a deadly rampage in the heart of Britain’s seat of power Wednesday, plowing a car into pedestrians on London’s Westminster Bridge before stabbing a police officer to death inside the gates of Parliament. Five people were killed, including the assailant, and 40 others were injured in what Prime Minister Theresa May condemned as a ‘‘sick and depraved terrorist attack.’’
Lawmakers, lords, staff and visitors were locked down after the man was shot by police within the perimeter of Parliament, just yards from entrances to the building itself and in the shadow of the iconic Big Ben clock tower. He died, as did three pedestrians on the bridge, and the police officer.
A doctor who treated the wounded from the bridge said some had ‘‘catastrophic’’ injuries. Three police officers, several French teenagers on a school trip and two Romanian tourists were among the casualties.
Police said they were treating the attack as terrorism. There was no immediate claim of responsibility.
Metropolitan Police counterterrorism chief Mark Rowley said police believed there was only one attacker, ‘‘but it would be foolish to be overconfident early on.’’ He said an unarmed policeman, three civilians and the attacker died. Forty others, including three police officers, were injured.
The dead officer was identified as Keith Palmer, 48, a member of the Parliamentary and Diplomatic Protection Command with 15 years of experience.
Islamic extremism was suspected in the attack, Rowley said, adding that authorities believe they know the assailant’s identity but would not reveal it while the investigation was ongoing.
The threat level for international terrorism in the U.K. was already listed at severe, meaning an attack was ‘‘highly likely.’’
Speaking outside 10 Downing St. after chairing a meeting of government’s emergency committee, COBRA, May said that level would not change. She said attempts to defeat British values of democracy and freedom through terrorism would fail.
‘‘Tomorrow morning, Parliament will meet as normal,’’ she said. Londoners and visitors ‘‘will all move forward together, never giving in to terror and never allowing the voices of hate and evil to drive us apart.’’
U.S. President Donald Trump was among world leaders offering condolences, and in Paris, the lights of the Eiffel Tower were to be dimmed in solidarity with London.
London has been a target for terrorism many times over past decades. Just this weekend, hundreds of armed police took part in an exercise simulating a ‘‘marauding’’ terrorist attack on the River Thames.
Wednesday was the anniversary of suicide bombings in the Brussels airport and subway that killed 32 people last year, and the latest events echoed recent vehicle attacks in Berlin and Nice, France.
In the House of Commons, legislators were holding a series of votes on pensions when deputy Speaker Lindsay Hoyle announced that the sitting was being suspended and told lawmakers not to leave.
Parliament was locked down for several hours, and the adjoining Westminster subway station was shuttered.
Conservative lawmaker Tobias Ellwood, whose brother was killed in the Bali terror attack in 2002, performed first aid on the wounded police officer, who later died. About 10 yards away lay the assailant.
‘‘I tried to stem the flow of blood and give mouth to mouth while waiting for the medics to arrive but I think he had lost too much blood,’’ Ellwood said. ‘‘He had multiple wounds, under the arm and in the back.’’
The attack began early Wednesday afternoon as a driver in a gray SUV slammed into pedestrians on the bridge linking Parliament to the south bank of the River Thames.
Former Polish foreign minister Radek Sikorski was in a car crossing the bridge when he heard ‘‘something like a car hitting metal sheet’’ and then saw people lying on the pavement.
‘‘I saw one person who gave no signs of life. One man was bleeding from his head. I saw five people who were at least seriously injured,’’ Sikorski told Poland’s TVN24.
Ambulances arrived within minutes to treat people who lay scattered along the length of the bridge. One bloodied woman lay surrounded by a scattering of postcards.
Police said one injured woman was pulled from the river.
The car crashed into railings on the north side of the bridge, less than 200 yards (meters) from the entrance to Parliament. As people scattered in panic, witnesses saw a man holding a knife run toward the building.
‘‘The whole crowd just surged around the corner by the gates just opposite Big Ben,’’ said witness Rick Longley. ‘‘A guy came past my right shoulder with a big knife and just started plunging it into the policeman. I have never seen anything like that. I just can’t believe what I just saw.’’
The attacker managed to get past a gate into Parliament’s fenced-in New Palace Yard, a cobbled courtyard in the shadow of the Big Ben clock tower.
Daily Mail journalist Quentin Letts said a man in black attacked the police officer before being shot two or three times as he tried to storm into the building.
‘‘As this attacker was running towards the entrance two plain-clothed guys with guns shouted at him what sounded like a warning, he ignored it and they shot two or three times and he fell,’’ Letts told the BBC.
The attacker fell to the cobbles just yards from the entrance to 1,000-year-old Westminster Hall, the oldest part of the parliamentary complex, busy with visitors and school groups. Beyond that, a corridor leads to the building’s Central Lobby, flanked by House of Commons and House of Lords chambers.
The prime minister was among lawmakers near the Commons at the time of the attack, and was quickly ushered away by security officers and driven back to Downing Street.
To get that far, the attacker would have had to evade the armed officers who patrol the Parliament complex in pairs, as well as Parliament’s own security staff, who don’t carry guns.
The attack unfolded near some of the city’s most famous tourist sites, including the London Eye, a large Ferris wheel with pods that overlook the capital. It was halted after the attack, stranding visitors in the pods, with an aerial view of the attack scene.
London Ambulance Service said medics treated 12 people for serious injuries and eight who were less seriously hurt.
Dr. Colleen Anderson of St. Thomas’ Hospital said some of the wounded had ‘‘catastrophic’’ injuries.
The French Foreign Ministry said that three students on a school trip from Saint-Joseph in the Brittany town of Concarneau were among the injured. Two Romanians were also among the injured, the country’s Foreign Ministry said.
U.S. President Donald Trump spoke with May by telephone and applauded ‘‘the quick response of British police and first responders,’’ spokesman Sean Spicer said.
London has often been the target of terrorist attacks, from IRA campaigns in the 1970s and 80s to more recent Islamist plots.
On July 7, 2005, four al-Qaida-inspired British bombers blew themselves up on three subway trains and a bus in London, killing 52 people.
British security forces say they have thwarted some 13 terror plots over the past four years, but in recent years the U.K. has largely been spared major international terror attacks such as the ones seen in Belgium and France.
Last year, a far-right supporter shot and killed British lawmaker Jo Cox, who had campaigned for the U.K. to remain in the European Union. Prior to that, an attacker claiming to be motivated by Syria stabbed three people at a London subway station.
The most gruesome recent attack occurred in 2013 when two Muslim converts of Nigerian descent attacked Lee Rigby, a British soldier who was walking down the street. The men ran Rigby down with their vehicle and then used a cleaver to hack him to death as bystanders watched in horror.
Video: A British official announces Parliament has been suspended amid the security incident.
Associated Press writers Sophie Berman, Gregory Katz and Rob Harris in London and Lori Hinnant in Paris contributed to this report.