LONDON—British police Sunday battled to contain a series of violent anti-immigration protests that have swept through several major cities in recent days, resulting in vandalized buildings, injured police and several fires in some of the worst unrest to hit the nation in more than a decade.

On Sunday, Prime Minister Keir Starmer blamed “far-right thuggery” and vowed to bring those taking part to justice. Police said nearly 150 people had been arrested since Saturday after multiple clashes with demonstrators.

The protests were ignited in part by false rumors spread on social media that a knife attack, which left three children dead at a Taylor Swift-themed dance class in the northern English town of Southport last week, was perpetrated by an undocumented Muslim migrant.

In the town of Rotherham in northern England on Sunday, videos on social media showed people wearing balaclavas smashing the glass door of a hotel that was rumored to house asylum seekers, as protesters chanted “get them out.” Police said 700 protesters gathered at the hotel and one police officer was knocked unconscious.

Meanwhile, youths wearing masks used metal bars to smash the windows of houses seemingly at random in the northern town of Middlesbrough. In Weymouth, on Britain’s south coast, protesters faced off with police on the beach.

As violence escalated on Sunday, the U.K. Home Office promised extra security at mosques. British prosecutors have brought in additional staff to swiftly bring charges against those arrested.

The disorder marks an early test for Starmer, who was elected as prime minister last month, as he looks to restore calm after five days of sporadically violent demonstrations that risk framing the first chapter of his tenure as a summer of unrest in the U.K.

After the stabbing attack in Southport last week that left three dead and eight injured, some social-media feeds falsely attributed the attack to a migrant. Police later named the suspect as 17-year-old Axel Muganwa Rudakubana, who was born in Wales. But conspiracy theories went viral on social media, fanned by several right-wing activists who encouraged people to protest.

Violence subsequently flared in Southport with videos showing hundreds of rioters hurling bricks, bottles and flares at police officers. In the ensuing days, it spread to other cities, including Liverpool, Manchester and Belfast. Protesters in the southern city of Bristol clashed with other demonstrators claiming to be antiracism campaigners.

A library was set on fire in Liverpool. In the northern city of Sunderland, a police station was set afire. The windows were smashed at a hotel that was thought to house asylum seekers in the city of Hull. In Belfast, Northern Ireland, a supermarket burned down on Saturday night after 600 people gathered in the city center to protest.

The protests don’t appear to be orchestrated by one individual or group. “While many demonstrations this weekend are being supported by the organized far right, there is no central organizer,” said Hope Not Hate, an advocacy group that campaigns against racism and fascism. “The majority appear locally led and have been announced on an ad hoc basis.”

Online videos of the protests often featured people chanting “stop the boats,” referring to the thousands of migrants who have been illegally smuggled into the U.K. on dinghies from France this year.

In the U.K., the far right—once spearheaded by the now largely defunct British National Party—has splintered into multiple groups often led or influenced by online activists.

“Disinformation is a huge driver of this appalling violence and we know a lot of those attending these so-called protests are doing so in direct response to what they’ve read online,” said Ben-Julian Harrington at the National Police Chiefs’ Council, which coordinates law enforcement in the U.K.

Nigel Farage, head of the anti-immigration party Reform UK, initially went online to question why the police didn’t treat the Southport attack as terrorism-related and asked whether the “truth is being withheld from us.” He later said he didn’t support violent protest and thuggery. He called for police to take firmer action against protesters.

The last time Britain witnessed disorder on this scale was in 2011 after the killing of a Black man in north London, which sparked looting and arson attacks. At the time, Starmer was the country’s most senior prosecutor and oversaw rapid trials to punish those involved.

“I want you to know this violent mob do not represent our country,” Starmer said on Sunday. “And we will bring them to justice.”

Write to Max Colchester at Max.Colchester@wsj.com