The prime minister says he is “appalled and sickened” by the stabbing attack in Reading that left three people dead.
Police arrested a 25-year-old man from Reading at the scene and say they are not looking for anyone else over the “terrorist incident”.
Boris Johnson has paid tribute to unarmed officers who detained the suspect, after he had also injured three other people.
And the PM promised action “if there are lessons that we need to learn”.
Mr Johnson said: “I’m appalled and sickened that people should lose their lives in this way and our thoughts are very much with the families and friends of the victims today.”
He said he had spoken to the chief constable of Thames Valley Police and praised the bravery of his officers, during the attack at Forbury Gardens, a park in Reading town centre.
“If there are lessons that we need to learn about how we handle such cases, how we handle the events leading up to such cases then we will learn those lessons and we will not hesitate to take action when necessary,” Mr Johnson said.
He said that included changes to the law, as they had done over the automatic early release of terrorist offenders.
Metropolitan Police Assistant Commissioner Neil Basu, head of counter-terrorism policing, said: “This was an atrocity.”
He said police have found “nothing to suggest anyone else was involved” in the incident at about 19:00 BST on Saturday.
Security sources told the BBC the man arrested, who lives in Reading, is thought to be Libyan.
Mr Basu said police were working with the coroner to formally identify those who had died and he praised the actions of Thames Valley Police officers – “unarmed and incredibly brave” – who detained the suspect.
He also praised members of the public who provided emergency first aid at the scene and said 41 witnesses had so far come forward.
He said “the motivation for this horrific act is far from certain” but added it was clear that it was not associated with an earlier peaceful Black Lives Matter demonstration at Forbury Gardens, the site of the attack.
Mr Basu said the public should not be alarmed about visiting busy places as a result of this attack.
“Let me be clear, there is no specific intelligence to suggest anyone attending crowded places is at risk, but I would ask the public: please continue with your daily lives, but be alert, not alarmed, when you are out in public,” he said.
An eyewitness to the attack at Forbury Gardens, a park near the centre of Reading, said he saw a man moving between groups of people in the park, trying to stab them.
Three people died in the attack, and another three were seriously injured. Two of the injured people have been discharged and one remains in hospital, although the injuries are not thought to be life-threatening.
The arrested man had previously been in prison in the UK for a relatively minor conviction, not a terrorism offence, sources told the BBC.
At the scene
By Linda Serck, BBC News
Reading appears desolate and in mourning this morning. Large areas outside the gardens are taped up and there are not many people here, mainly journalists and their TV cameras.
A strong wind is rattling litter in grey, deserted streets, most of which are being patrolled by armed police. Commuters are struggling to get to work as so many roads have been cordoned off with police tape.
The few people arriving from Reading station expressed “shock”. Marie Castro from Slough works at a Costa coffee shop in Reading and said: “I was scared to be here but I have to be here for work.”
The attack “doesn’t seem right for Reading”, she added.
Real Life. Real News. Real Voices
Help us tell more of the stories that matterBecome a founding member
“It’s multicultural and really friendly. I was really shocked when I heard the news”.
A block of flats on Basingstoke Road in Reading was raided by more than a dozen armed police officers carrying shields at about 23:00 BST on Saturday.
About an hour and a half after they entered, a loud bang was heard at the scene, after which several of the armed officers left.
Craig O’Leary, chairman of the Thames Valley Police Federation, said the “swift action” of officers at the scene prevented “potentially more lives from being lost”.
“There are barely words to describe their bravery – officers who ran towards danger with the sole thought of protecting the public we serve,” he said.
One officer “rugby tackled” the suspect to the ground, according to a report in the Sunday Mirror.
Floral tributes to the victims have been left at the scene. One read: “”There are no words that anyone can say to express how horrible and senseless this was.
“Our prayers are with all the victims and their families and friends.”
Subscribe to the newsletter news
We hate SPAM and promise to keep your email address safe