Sweden’s prime minister, who criticized President Trump last year for blaming Swedish violence on Muslim refugees, said Tuesday that he’s cracking down on immigration and gang violence to make Sweden great again.

At a White House news conference with Mr. Trump at his side, Prime Minister Stefan Löfven spoke of his own Trump-like agenda of implementing tougher laws on immigration and crime, and of spending more money on law enforcement.

“We have our share of domestic challenges, no doubt about that,” Mr. Lofven said. “We are dealing with it every day, allocating more resources to the police, more resources to the security police, tougher laws on crime, tougher laws on terrorism.”

Not only that, he said Sweden’s crackdown on immigration and gangs is working.

“We can see some results now in our three major cities, decrease in shootings because we’re attacking the organized crime very tough,” the prime minister said. “And we’ll keep on doing that. There is no space in Sweden for organized crime. They decrease freedom for ordinary people.”

It sounded very much like Mr. Trump’s rhetoric against the MS-13 gang members that he seeks to deport in larger numbers, and his policies to limit migration from certain Muslim-majority countries until better screening is in place to weed out potential terrorists.

The president, who enjoys being right as much as anyone, told the audience in the East Room that he had been correct about Sweden all along.

“Certainly you have a problem with immigration, it’s caused problems in Sweden,” Mr. Trump told a Swedish journalist. “I was one of the first ones to say it. I took a little heat, but that was OK. I proved to be right. But you do have a problem. I know the problem will slowly disappear, hopefully rapidly disappear.”

A year ago, soon after Mr. Trump took office, he was roundly criticized in the U.S. media and in Europe for blaming a rise in crime in Sweden on an influx of Muslim refugees.

“You look at what’s happening last night in Sweden,” the president said back then at a rally in Florida. “Sweden. Who would believe this? Sweden. They took in large numbers. They’re having problems like they never thought possible.”

At the time, Swedish officials said they didn’t know what Mr. Trump was talking about. Some people accused Mr. Trump of responding to an erroneous news report.

A year ago, Mr. Lofven chided Mr. Trump publicly, saying “We must all take responsibility for using facts correctly and for verifying anything we spread.”

But on Tuesday at the White House, the prime minister had changed his tune. He noted that Sweden had received 163,000 refugees in 2015, with most arriving in a span of a few months.

“We inherited a legislation that was not sustainable, legislation on migration,” Mr. Lofven said. “We changed the legislation, so now we have decreased the number of refugees, and we’re also putting pressure on the other European Union countries to take their share of the responsibility.”

The New York Times reported last weekend that Sweden has experienced a rise in clan-like violence, including gangs using hand grenades, that accompanied an influx of immigrants from certain parts of Europe and the Middle East. There have been more than 100 incidents involving military-grade explosives in the Stockholm metro area, which police have attributed to an “arms race” among immigrant gangs, the paper reported.

The story said there were few such incidents in Sweden until 2014, but since then, the number of explosions and seizures of grenades has risen.

Mr. Lofven refuted recent reports that immigrant-related crime in Sweden had become so bad that authorities had designated “no-go zones” deemed too dangerous to enter.

“We also have problems with organized crime in Sweden, shootings,” he said. “But it’s not like you have these ‘no-go’ zones.”

Until recently, Sweden had the most generous immigration laws in Europe. Former Prime Minister Fredrik Reinfeldt in 2014 made a famous speech urging Swedes to “open their hearts” to refugees seeking shelter.

But in 2016, as problems grew, Sweden enacted a law valid for three years that makes family reunification of refugees more difficult. The law stopped recent immigrants with residency permits from bringing their immediate family members to Sweden.

In the U.S., Mr. Trump wants to end so-called “chain migration,” which he says has allowed an immigrant to sponsor numerous relatives to follow him or her, with not enough vetting of the family members.

Mr. Lofven, again sounding a lot like Mr. Trump, said Sweden is overcoming its immigration and crime problems with a thriving economy.

“Sweden has high growth,” he said. “Unemployment is going down. We have high investment rates. We have a strong, strong economy.”