(Jason Aldag,Victoria Walker/The Washington Post)

An assailant fatally stabbed a police officer at the gates to Britain’s Parliament compound Wednesday after plowing a vehicle through terrified pedestrians along a landmark bridge. The ­attacker was shot and killed by police, but not before claiming a total of four lives in what appeared to be Europe’s latest high-profile terrorist attack.

In a late-night statement, London Metropolitan Police said that they believed they knew who the attacker was, but declined to give a name. Speaking outside the Scotland Yard headquarters, Mark Rowley, the acting deputy police commissioner, said: “Our working assumption is he was inspired by international terrorism.”

Police said the man traced a deadly path across the Westminster Bridge, running down people with an SUV, then ramming the vehicle into the fence encircling Parliament. At least 40 people were reported injured.

Finally, the attacker charged with a knife at officers stationed at the iron gates leading to the Parliament grounds, authorities said. The fallen police officer was identified as Keith Palmer, a 48-year-old husband and father who was unarmed at the time of the attack.

The dead and injured were left scattered on some of London’s most famous streets.

Crumpled bodies lay on the Westminster Bridge over the River Thames, including at least two people killed. Outside Parliament, a Foreign Office minister — covered in the blood of the stabbed police officer — tried in vain to save his life.

“The location of this attack was no accident,” British Prime Minister Theresa May said Wednesday evening, after chairing ­COBRA, the government’s emergency committee. “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.”

But she said that “any attempt to defeat those values through violence and terror is doomed to failure. Tomorrow morning, Parliament will meet as normal,” she said.

The scene at Parliament earlier in the day was one of confusion while the Parliament chambers and offices were put on full lockdown for more than two hours.

“This is a day that we planned for but hoped would never happen. Sadly, it has now become a reality,” Scotland Yard’s Rowley said during one of his briefings.

As he spoke, the bells of Big Ben tolled six times to mark the hour.

Even before full details emerged, the attack and its chaos were certain to raise security levels in London and other Western capitals and bring further scrutiny of counterterrorism measures.

“We are treating this as a terrorist incident until we know otherwise,” said a Twitter message from London Metropolitan Police.

The attack occurred on Parliament’s busiest day of the week, when the prime minister appears for her weekly questions session and the House of Commons is packed with visitors.

The Palace of Westminster, the ancient seat of the British Parliament, is surrounded by heavy security, with high walls, armed officers and metal detectors. But just outside the compound are busy roads packed with cars and pedestrians.

The attack — a low-tech, high-profile assault on the most potent symbol of British democracy — fits the profile of earlier strikes in major European capitals that have raised threat levels across the continent in recent years.

It was apparently carried out by a lone assailant who used easily available weapons to attack and kill people in a busy public setting.

British security officials have taken pride in their record of disrupting such attacks even as assailants in continental Europe have slipped through. But they have also acknowledged that their track record would not stay pristine, and that an attack was inevitable. When it happened, it was shocking nonetheless. Cellphones captured scenes of carnage amid some of London’s most renowned landmarks.

The target — Westminster — was heavily guarded. But the weapons of choice — an SUV and a knife — made the attack one of the most difficult kinds to prevent, requiring the assailant neither to acquire illegal weapons nor to plot with other conspirators.

Rowley said investigators believe that just one assailant carried out the attack, but he encouraged the public to remain vigilant.

Britain has been on high alert for terrorist attacks for several years. But until Wednesday, the country had been spared the sort of mass-casualty attacks that have afflicted France, Belgium and Germany since 2015.

Among those providing emergency aid was Tobias Ellwood, a senior official at the Foreign Office and a British military veteran. Photos showed Ellwood’s face streaked with blood after attempting to revive the police officer who had been stabbed just inside the gates of the compound.

French Prime Minister Bernard Cazeneuve said that among those wounded in the vehicle attack were members of a group of French students. News media in France reported that three of the students, on a school trip from a high school in Brittany, were in serious condition and that their parents were being flown to London immediately.

In Washington, White House press secretary Sean Spicer said President Trump had been briefed on the attack and had spoken by phone with Prime Minister May.

“We condemn today’s attack in Westminster,” Spicer told reporters. He pledged “the full support of the U.S. government in responding to the attack and bringing to justice those who are responsible.”

Raffaello Pantucci, director of international security studies at the Royal United Services Institute think tank, said the rapid response suggested that police “were expecting that an attack was highly likely for some time.”

Images from the bridge showed a man dressed in a suit lying on his back, his legs splayed to either side, as pedestrians huddled around him administering first aid. The shoe was off his right foot, and blood stained the sidewalk beneath his left.

In another image, a woman with long blond hair and running shoes lay in a pool of blood on the bridge’s sidewalk. Blood stained the corner of her mouth as another pedestrian cradled her head.

Other photos showed people sitting on the sidewalk looking dazed amid broken glass and bits of automotive debris, with Big Ben looming beyond.

A spokesman for the Port of London Authority said a woman was pulled alive from the River Thames, and he confirmed reports that she had serious injuries.

As police investigated, much of the activity in the area around Westminster came to a standstill.

A nearby hospital was put on lockdown and the London Eye — the enormous Ferris wheel above the Thames — was stopped and visitors were slowly let off hours later. Those who were locked inside the Eye’s capsules at the time of the attack were kept there, hovering above as emergency responders swarmed the scene below.

A witness, Kirsten Hurrell, 70, said she first heard the crash of a car hitting the fence outside Parliament before hearing noises that could have been gunshots.

“There was a lot of steam from the car,” Hurrell told the Guardian newspaper. “I thought it might explode.”

The U.S. Department of Homeland Security said it was in “close contact with our British counterparts to monitor the tragic events and to support the ongoing investigation.” It noted that U.S. security threat levels remained unchanged.

A year ago to the day, attackers carried out three coordinated suicide bombings in Belgium, killing 32 civilians and injuring more than 300 others in two blasts at Brussels Airport and one at a metro station in the Belgian capital. The Islamic State asserted responsibility for the attacks, in which three perpetrators were also killed.

As the aftermath of the London attack unfolded, the Welsh Assembly and the Scottish Parliament suspended their sessions. Scottish lawmakers had been due to debate legislation authorizing a new referendum on independence.

Specialists said the attack appeared to be in line with an emerging model of strikes involving simple, everyday instruments but carried out in locations sure to draw global attention.

“Terrorists rely on a lot of people watching — it can be even better than having a lot of people dead,” said Frank Foley, a scholar of terrorism and counterterrorism at the Department of War Studies at King’s College London.

Within a few hours of the attack, there were signs that normalcy was returning to London.

At the London Eye, a large crowd of tourists gathered.

Charles Thompson, a 21-year-old chef from Canada, wondered if there would be more attacks. “Usually it’s a chain-reaction thing,” he said.

His friend, Enrique Cooper, a 32-year-old officer manager originally from Italy, said he would not let the day’s violence change his view of London. “I’m here all the time,” he said. “You can’t let something like this ruin your perspective.”

Witte reported from Madrid. Adam Taylor and Isaac Stanley-Becker in London, James McAuley in Paris and Brian Murphy, William Branigin and Mark Berman in Washington contributed to this report.