a person crossing a city street: Police officers patrolling near London Bridge on Saturday, after a deadly attack by a man armed with knives.

Police officers patrolling near London Bridge on Saturday, after a deadly attack by a man armed with knives.

© Alberto Pezzali/Associated Press

 LONDON — It was midafternoon when Mike Finnerty, who sells cheese at his Borough Market shop just south of London Bridge, realized that something was wrong. An unusual flow of people had suddenly gathered in front of his stall, he said, and they seemed “alarmed.”

What he did not know was that a man dressed in black and armed with knives had gone on a murderous rampage in a grand meeting venue called Fishmongers’ Hall on the opposite side of the bridge, just north of the Thames River. But Mr. Finnerty sensed the danger on Friday, he would later tell the BBC and write on Twitter.

Sign Up For the Morning Briefing Newsletter

So he and another employee rushed some customers — a couple from Vancouver and a young American man — into a cheese refrigerator and locked the door. Then he called the police.

The “operator said it was an attack and not to move,” he wrote. He said he could hear shouting outside the door, but he and the group huddled together in “pretty close quarters.”

Susan Vinn, 57, was smoking outside her office adjacent to Fishmongers’ Hall about 2 p.m. when she saw people running over the bridge. And Craig Heathcote, a filmmaker, was walking there when, he told the British broadcaster Sky News, someone said:

“Get out of the way. Someone’s got a knife.”

On Saturday, Britain grappled with the aftermath of another terrorist attack in the heart of London just as the Islamic State, also known as ISIS, claimed responsibility. Two people were killed and at least three were wounded in Friday’s assault.

In a statement, ISIS said the assailant had carried out the attack in its name and added that he had done so “in response to calls to target coalition countries.” The phrasing indicates that the attacker was inspired by the group’s ideology and refers to a speech by a former spokesman, who urged followers to carry out attacks in any way they could, including stabbing.

This attack, the police said, had been carried out by a man wearing a fake bomb vest, a former prisoner who had been convicted of terrorism offenses in 2012. The authorities identified the suspect as Usman Khan, 28, of Stafford, England, who was released from prison last year, apparently after agreeing to wear an electronic tag.

He was part of a gang that plotted in 2010 to plant explosives in the toilets of the London Stock Exchange, the authorities said, and possibly attack other British landmarks and prominent figures like Boris Johnson, then the mayor of London.

The rampage on Friday, near the same bridge where a terrorist attack by a group men in June 2017 left eight people dead and dozens injured, raised questions about the efficacy of Britain’s prison rehabilitation system and about the early release from prison of Mr. Khan, despite warnings from the judge at his trial about the threats he still posed.

In his judgment, Lord Justice Brian Leveson said there was “no doubt that anyone convicted of this type of offense could legitimately be considered dangerous.”

In February 2012, Mr. Khan was given an indeterminate sentence, with a minimum term of eight years, but the Court of Appeal replaced it in 2013 with a 16-year fixed-term sentence. He was released in half the time.

The attack occurred two weeks before a pivotal general election, and Mr. Johnson, now the prime minister, is under pressure. He told reporters on Saturday that he wanted to “toughen up” sentences.

“I have long argued that it is a mistake to allow serious and violent criminals to come out of prison early,” Mr. Johnson said.

On Saturday, the Parole Board, which carries out risk assessments on prisoners to determine whether they can be safely released, said in a statement that it had not reviewed his case. Mr. Khan appeared to have been released automatically, “on license” — meaning under certain conditions — “without ever being referred to the board,” it said.

On Sunday, the Ministry of Justice said it had began an urgent review of the license conditions of convicted terrorists released from prison.

Along with questions about the case came praise for the bystanders who had charged the suspect as he made his way along the bridge. One man wielded a fire extinguisher, video footage on social media showed. Another brandished an ornamental whale tusk that had been torn from the wall of Fishmongers’ Hall, according to local reports.

The assailant was wrestled to the ground in the street outside the grand hall. A man wearing a suit and tie can be seen removing a knife and walking away from the suspect. He was later identified as an off-duty member of the transport police.

Thomas Gray, a tour company manager, told reporters that he saw one of the knives taped to Mr. Khan’s hands.

“I stamped on his left wrist while someone else smacked his hand on the ground and then kicked one of the knives away,” Mr. Gray told Sky News. “I went to pick up the knife when I heard a cop say, ‘He has got a bomb.’”

The bomb turned out to be fake. Footage showed officers, guns drawn, pulling bystanders off Mr. Khan. Then, Mr. Khan was shot and killed by the police.

The trauma of the encounter, which played out as workers looked down from huge office windows and as onlookers shared video of the chaos, led Ms. Vinn to ask: “Why London Bridge anyway? It’s horrible, I don’t get it.”

She said that for a country that has experienced terrorist attack after terrorist attack since 2017: “It’s become ambient. It makes you worried about your safety on a day-to-day basis, especially here, around London Bridge.”

Mayor Sadiq Khan of London praised the bravery of bystanders. “What’s remarkable about the images we’ve seen,” he said, “is the breathtaking heroism of members of the public who literally ran toward danger, not knowing what confronted them.”

The assault threw into stark relief the risks in attempting to rehabilitate those convicted or suspected of terrorism.

On Saturday, Chris Phillips, a former head of the country’s National Counter Terrorism Security Office, said Britain was releasing people while they were still radicalized.

“We’re playing Russian roulette with people’s lives, letting convicted, known, radicalized jihadi criminals walk about our streets,” he told the Press Association news agency.

David Videcette, a former antiterrorism detective and author, added that Britain must “look at sentencing and rehabilitation, as we have a huge problem with terrorist prisoners that are being released, and with those that want to come back from Syria.”

Usman Khan was attending an event at Fishmongers’ Hall for former prisoners and their mentors in a prison education program, Learning Together, set up by Cambridge University. He was believed to have been invited to share his experiences as a former prisoner.

“We believe that the attack began inside before he left the building and proceeded onto London Bridge,” said Neil Basu, assistant commissioner of the Metropolitan Police.

One of those who rushed to aid victims, according to news reports, was a man convicted of murder who had been on day release.

Among those killed, according to the BBC and the news site Cambridge Live, was a Cambridge graduate, Jack Merritt, the course coordinator of Learning Together. The police did not immediately confirm his identity. But a man who said he was Mr. Merritt’s father, David, posted the news on Twitter before deleting it.

“My son, Jack, who was killed in this attack, would not wish his death to be used as the pretext for more draconian sentences or for detaining people unnecessarily,” the post read. “R.I.P. Jack: you were a beautiful spirit who always took the side of the underdog.”

On Saturday, three people remained hospitalized, and one person who been critically wounded was in stable condition, the National Health Service said in a statement.

The attack came only weeks after the British government lowered its terror threat warning level to substantial from severe as Britons had begun growing cautiously accustomed to a life less frequently disrupted by deadly episodes.

In 2017, when London Bridge and the nearby Borough Market were the subject of an attack, there was also a suicide bombing at the Manchester Arena, an attack on Westminster Bridge and at the gates of Parliament, and an assault at a north London mosque.

For a government seeking re-election in two weeks’ time, the issue is sensitive. Before the 2017 general election, the opposition Labour Party had linked terror attacks to police cuts made by a Conservative-led government.

On Saturday, Brandon Lewis, the security minister, did not say whether he considered the attack to be a failure by the authorities, but he sought to rebut suggestions that cuts to the police had played a role. He told Sky News that both funding and the number of officers devoted to counterterrorism had “consistently increased since 2015.”

Mr. Videcette, the former antiterrorism detective, said that many lower-level offenders were now up for release, and to monitor them, the authorities had to keep close watch on those with whom they associate. The problem, he said, was “if they don’t reconnect with the individuals we expect them to” and opt instead for a low-tech, lone attack.

“There is a real danger,” he said, “with those who have not reached the pinnacle of what they are going to be but aspire to be a well-known terrorist, or perhaps aspire to be martyred by a police officer in a terror attack”

Elian Peltier contributed reporting from London, and Rukimini Callimachi from Bucharest, Romania.

Elian Peltier contributed reporting from London, and Rukimini Callimachi from Bucharest, Romania.