The targets were eerily familiar: a cartoonist, police officers and Jews.

The manhunt, too, had echoes: a European capital on virtual lockdown as police searched block by block, with helicopters sweeping the skies.

And after the suspect had been shot to death on a Copenhagen street, the profile that emerged was remarkably similar: a habitual criminal who, after serving time in prison, emerged as an ideologically motivated killer.

A month after homegrown terrorists traumatized France, a 22-year-old who was born and raised in Denmark tormented this nation for 12 hours over a murderous weekend that left many in this normally placid country wondering whether Europe has entered a new normal of unending fear.

Before a pre-dawn shootout with police ended his rampage, the assailant left two people dead and five police officers wounded, having attacked a cafe hosting a debate focused on free speech and a synagogue where a bat mitzvah was underway. In each case, a heavy security presence probably prevented the attack from becoming a massacre.

Police believe he carried out the attacks alone, but on Monday they announced that two men had been charged with helping the assailant by “giving advice and assistance in connection to the shooting,” a police spokesman said.

Danish Foreign Minister Martin Lidegaard told the BBC on Monday that the attacks were believed to be “lone wolf” acts.

“As far as I am informed right now, we are not talking about a foreign fighter who has been abroad fighting in Syria or Iraq. We are talking about a man who was known by the police due to his gang activities, criminal activities inside Denmark — whether he has been radicalized inside jail, where he was just released from, or he has been moving around in these environments before, is yet rather unclear,” he said.

The parallels between last month’s attacks and the ones here focused investigators’ attention on the possibility that the assailant here was a copycat killer, “inspired by the events in Paris,” Jens Madsen, head of the Danish security agency PET, said in a news conference Sunday.

The reaction, too, followed familiar patterns. Danish leaders vowed not to shrink from terror as mourners gathered for solemn candlelight vigils to honor the dead. With Denmark’s small Jewish community feeling especially vulnerable, Israeli Prime Minister Benjamin Netanyahu used the occasion of an anti-Semitic attack on European soil to again encourage immigration to the Jewish homeland.

Danish Prime Minister Helle Thorning-Schmidt at a news conference Monday had her own message for the Jewish community, saying that they “have been in this country for centuries, they belong in Denmark, they are part of the Danish community, and we wouldn’t be the same without the Jewish community in Denmark.”

As was the case in the Paris assaults, police said the killer had an extensive rap sheet, including convictions for assault and weapons possession. He also had a history of gang involvement. Although police did not name the suspect, widespread reports in the Danish media identified him as Omar Abdel Hamid el-Hussein and said he had recently been released from prison.

Unlike the killers in Paris, who variously claimed allegiance to al-Qaeda and the Islamic State, it was not immediately clear whether the attacker here had connections to established extremist organizations. But that may not have mattered.

“There is a confluence between criminal gangs and extremism which is more pronounced in Denmark than in other countries,” said Magnus Ranstorp, a terrorism expert who is leading a counterextremism effort in Copenhagen. “There are gang leaders here who have gone on to participate in the fighting in Syria.”

At least 110 young Danes have left to wage war in Iraq and Syria, which by some measures is the second-highest per capita number in Western Europe, behind Belgium. In total, more than 4,000 Western Europeans have joined the fight — a flow that has overwhelmed intelligence agencies across the continent.

The assailant in this weekend’s attacks was well known to Danish intelligence, Madsen said. In November 2013, Hussein stabbed a teenager in the thigh while aboard a commuter train, and according to Danish media, he had recently been released from prison following his conviction.

But it was unclear whether this weekend’s assailant was under surveillance and, if so, how he managed to slip free long enough to plan an attack with an assault rifle.

His first target was a gathering convened by a Swedish cartoonist, Lars Vilks, to discuss free speech in the age of terrorism. Vilks, 68, has long been marked for death by Islamist extremists for his depictions of the prophet Muhammad, including one that shows him with the body of a dog.

Vilks and dozens of other attendees survived the Saturday afternoon attack, but a 55-year-old documentary filmmaker, Finn Noergaard, was killed when the cafe hosting the event was raked by scores of bullets. Three police officers were wounded.

After fleeing in a Volkswagen, the assailant struck again after midnight, shooting a volunteer security guard in the head outside the Great Synagogue of Copenhagen as about 80 people celebrated a bat mitzvah in an adjacent building. The guard, 37-year-old Dan Uzan, was killed, and two police officers were wounded. But the suspect fled without gaining access to the building.

Jewish leaders said that they had been asking for additional security for weeks but that police had been deployed outside the synagogue only after the attack on the cafe Saturday afternoon.

“It’s an absolute nightmare to think what could have happened,” said Dan Rosenberg Asmussen, chairman of the Jewish Community in Denmark. “We’ve been afraid of something like this, and we’ve been warning the authorities.”

While attacks such as the ones this weekend have no direct precedent in Denmark, the threat has long been known. The decade-long storm of controversy over Muhammad cartoons has its origins here, following publication of a series of 12 by the Danish newspaper Jyllands-Posten in 2005.

Still, for a country unaccustomed to gun violence, news of the attacks came as an especially violent assault on the nation’s core beliefs.

“I’m furious,” said Rita Sorensan, a retiree who had come to lay flowers at a makeshift memorial to Noergaard, just beyond a barricade manned by assault-rifle-wielding officers. “There are many, many people who don’t respect the values of Denmark. And I don’t think it stops here. I’m not naive. I’m expecting more attacks.”

Police, too, were focused on the possibility that there would be more attacks. Security forces tracked the killer using CCTV footage, and officials said he opened fire on officers as they approached him near an apartment building in an ethnically diverse neighborhood of north Copenhagen before dawn. The assailant had visited the building, near a train station, in between the two attacks.

“The culprit that was shot by the police task force is the person behind both of these assassinations,” Torben Molgaard Jensen, the chief police inspector, told reporters.

But police had not ruled out the possibility of accomplices. Late Sunday afternoon, security forces stormed an Internet cafe not far from the shootout and detained two suspects. It was not clear if the raid was directly related to the shootings.

Meanwhile, there were reminders over the weekend across Europe of the transnational nature of extremism and anti-Semitism.

In the northern German city of Braunschweig, a carnival that normally attracts a quarter-million revelers was canceled at the last minute because of a terrorism threat, police said.

They said in a statement that there was a “concrete threat of an Islamist attack” and that they had received a tip from “reliable state security sources.”

In Sarre-Union, a town in northeastern France, hundreds of graves in a Jewish cemetery were desecrated. A monument to Holocaust victims also was vandalized.

Prime Minister Manuel Valls called the attack “vile” and “anti-Semitic” and said every effort would be made to find those responsible.

Adam reported from London. Stephanie Kirchner in Berlin and Maren Mosaker in Copenhagen contributed to this report.