The suspected gunman behind double shootings in Copenhagen was identified as a 22-year-old with a history of violent crime who had only been freed from jail two weeks ago.

With Europe fearful of a new wave of jihadist violence, police said the man who killed two people at a cultural centre and a synagogue before being shot dead by police may have been inspired by last month’s Paris attacks.

Expressions of sympathy and horror poured in from across the world after the weekend shootings described by Danish prime minister Helle Thorning-Schmidt as a “cynical act of terror”.

At the synagogue in the centre of Copenhagen, tearful Danes laid flowers and lit candles for the victims of the worst such attack in the normally peaceful Scandinavian nation.

Police issued a photograph of the suspected lone gunman, who was said by the Ekstra-Bladet tabloid to have been released from prison two weeks ago after serving a term for aggravated assault.

Police launched a series of raids across Copenhagen after tracking down and killing the suspect in a pre-dawn shootout in a working class area of the Danish capital.

Investigators said the man, who was born and raised in Denmark, had a history of assault and weapons offences and that they were trying to ascertain if he had help from any accomplices.

In a killing spree that bore a striking resemblance to the Paris attacks, the gunman first fired off a volley of bullets on Saturday at a cultural centre where a panel discussion about Islam and free speech was taking place.

A 55-year-old man identified by the media was documentary film maker Finn Norgaard was killed at the event, which was also attended by Lars Vilks, a Swedish cartoonist behind a controversial caricature of the Prophet Mohammed, and the French ambassador.

In the second attack, the gunman opened fire outside the city’s main synagogue while a bar mitzvah was being celebrated, killing a 37-year-old Jewish man named as Dan Uzan who was guarding the building.

Five police were also wounded in the attacks that stoked fear in the city of about one million people, one of the world’s safest capitals.

Audio of cafe shooting in Denmark

Police said the gunman was already “on the radar” of the intelligence services and that they were looking into the possibility he had travelled to conflict zones such as Syria and Iraq.

“He may have been inspired by the events that took place in Paris a few weeks ago,” Jens Madsen, head of the Security and Intelligence Service, told reporters.

He said he may “have been inspired by militant Islamist propaganda issued by IS (Islamic State) and other terror organisations”.

A photo of the suspect issued soon after the cultural centre attack showed him wearing a black puffer jacket and a maroon balaclava and carrying a black bag.

Armed officers raided a Copenhagen Internet cafe in one of a series of operations on Sunday, leading away at least two people, possibly under arrest, local media said.

The attacks have revived fears about jihadist violence since the bloody events in Paris on January 7-9.

Europe has been on high alert with dozens of suspected radical Islamists arrested across several countries and stocks of weapons and explosives uncovered.

French president Francois Hollande said on a visit to the Danish embassy in Paris that the targets in Denmark and France were the same.

“We see there is a link that doesn’t show there is a network but does show the terrorists are determined to hit what we are, what we represent, the values of freedom, of law, of protection that every citizen - whatever his or her religion - should have,” he added.

Four Jews were among a total of 17 people killed in the French capital in attacks on a kosher supermarket and the Charlie Hebdo satirical weekly, which was targeted because it had published cartoons lampooning the Prophet Mohammed.

The Danish newspaper Jyllands-Posten was itself the centre of global controversy after publishing Mohammed cartoons in 2005 that triggered protests across the Muslim world.

Israeli prime minister Benjamin Netanyahu urged European Jews to move to Israel after Saturday’s shooting, echoing a similar call made after the Paris attacks.

And in Germany, a carnival parade was cancelled on Sunday because of a “specific threat” of an Islamist attack.

British prime minister David Cameron condemned the Copenhagen shootings as an “appalling attack on free speech and religious freedom”, while the United States branded them “deplorable”.

UN secretary-general Ban Ki-moon in the wake of the attacks called on society to stand up for tolerance.

“There is no justification for attacks against civilians and (Ban) reiterates the need to stand strong for freedom of expression and tolerance,” a spokesman Stephane Dujarric said.

The central area of Copenhagen that is home to both the synagogue and Noerreport station, the country’s busiest rail hub, was cordoned off by police carrying machine guns.

The windows of the cultural centre were pockmarked by bullet holes, and the BBC released chilling audio of the moment a speaker at the event was interrupted by a barrage of gunfire.

“It’s terrible. It’s an attack on the free world,” said 84-year-old Copenhagen resident Joergen Johanssen.

In Paris, several hundred demonstrators gathered at the Danish embassy, some chanting “Je suis danois,” echoing the slogan “Je suis Charlie” that took hold around the world after the French attacks.