Police shot dead a gunman on Sunday whose attacks on a Copenhagen synagogue and an event promoting free speech may have been inspired an attack on French satirical weekly Charlie Hebdo last month, authorities said.
Denmark's spy chief Jens Madsen said the gunman was known to the intelligence services prior to the shooting and probably acted alone. He did not elaborate.
Two civilians were killed and five police were wounded in the two separate attacks in the Danish capital on Saturday.
"We cannot yet say anything concrete about the motive ... but are considering that he might have been inspired by the events in Paris some weeks ago," Madsen told a news conference.
Danish authorities have been on alert since Islamist gunmen killed 17 people in three days of violence in Paris in January that began with an attack on Charlie Hebdo, long known for its acerbic cartoons on Islam, other religions and politicians.
Police who had earlier released a photo of the suspect dressed in a heavy winter coat and maroon mask, said they did not believe he had received training in Jihadist camps in the Middle East.
Witnesses to the Copenhagen attacks said the gunman fired up to 40 shots at a cafe hosting a free speech event with Swedish artist Lars Vilks, who has received death threats for depicting the head of the Prophet Mohammad on a dog.
Vilks was unhurt but a 55-year-old man was killed. A guard was later shot in the head outside Copenhagen's biggest synagogue, where around 80 people were celebrating a confirmation. Two police officers were also wounded there.
Police shot dead the suspect early on Sunday after he opened fire on them near a railway station in the Noerrebro district, not far from the sites of the two attacks. Officers later searched his home, which was nearby.
Prime Minister Helle Thorning-Schmidt said the attacks were terrorism and promised to protect freedom of speech and Denmark's small but vibrant Jewish community.
"When you mercilessly fire deadly bullets at innocent people taking part in a debate, when you attack the Jewish community, you attack our democracy," Thorning-Schmidt said outside the synagogue. "We will do everything possible to protect our Jewish community."
Denmark's former chief rabbi, Rabbi Bent Lexner, told Israeli Army Radio the synagogue guard was "a fantastic guy", adding: "We are in shock. I am sitting now with the parents of the man killed. We didn't think such a thing could happen in Denmark."
Israeli Prime Minister Benjamin Netanyahu said such attacks would likely continue and said Israel would welcome European Jews who choose to move to there.
Witnesses said French ambassador Francois Zimeray had just finished introducing the cafe event, entitled "Art, Blasphemy and Freedom of Expression", when the assailant opened fire.
The venue was heavily-guarded by police, who fired back, but the attacker nevertheless escaped.
Vilks, who security experts said they believed was the gunman's main target, sheltered on the floor of a cold room at the back of the cafe with one of the event's organiser.
"The rather spare audience got to experience fear and horror - and tragedy. I can't say it affected me as I was well looked after," Vilks wrote in a blog post.
Helle Merete Brix, organiser of the event at the cafe, told Reuters she had seen an attacker wearing a mask.
"The security guards shouted 'Everyone get out!' and we were being pushed out of the room," Brix said.
"They tried to shoot their way into the conference room ... I saw one of them running by, wearing a mask. There was no way to tell his face."
Denmark became a target of violent Islamists 10 years ago after the publication of cartoons lampooning the Prophet Mohammad, images which led to sometimes fatal protests in the Muslim world. Many Muslims consider any representation of the Prophet blasphemous.
Vilks stirred controversy himself in 2007 with drawings depicting Mohammad's head on a dog, triggering death threats.
He has lived under Swedish police protection since 2010 and two years ago, an American woman was jailed for 10 years in the United States for plotting to kill him.
Like other European governments, Scandinavian leaders have been increasingly concerned about the radicalization of young Muslims travelling to Syria and Iraq to fight alongside violent jihadist groups such as Islamic State.
Authorities have also been worried about possible lone gunmen like Anders Behring Breivik, the anti-immigrant Norwegian who killed 77 people in 2011, most of them at a youth camp run by Norway's ruling center-left Labor Party.
French Foreign Minister Laurent Fabius said he was struck by the similarities between the Copenhagen and Paris attacks: "First an attack against freedom of speech, then an attack against Jews, and then the confrontation with the police," he told Europe 1 radio.