The head of Danish intelligence said investigators were working on the theory that the gunman who killed two people in Copenhagen could have been motivated by the shootings in Paris last month.
Omar El-Hussein, a 22-year-old Danish man, killed two men: a film director at an attack on a cafe hosting a debate on free speech and, later a guard at the city's main synagogue.
Police say they then killed him in the Norrebro district after he opened fire on them.
Police said video surveillance suggested he carried out both attacks. They do not believe any other people were involved.
They said he was known to them in connection with criminal gangs and had convictions for violent offences and dealing in weapons.
"It was the case that when the suspect was shot and killed during police action, he was armed with pistols," police commissioner Thorkild Fogde said.
He also said police had found a weapon which may have been used in the first shooting.
Investigators said the attack may have been inspired by attacks on Charlie Hebdo magazine, a kosher supermarket and a policewoman that claimed 17 lives in the French capital in January.
The head of Danish intelligence Jens Madsen said the man had been identified and had been on the agency's radar for some time.
Police were working to determine whether the man had travelled to Syria or Iraq, he said.
Prime Minister Helle Thorning-Schmidt said it was "a very sad morning" and described the shootings as "a cynical act of terror against Denmark".
"We do not know the motive for the alleged perpetrator's actions, but we know that there are forces that want to hurt Denmark. They want to rebuke our freedom of speech,'' she said, according to the Associated Press.
Ms Thorning-Schmidt later visited the synagogue and said Denmark would do everything to protect its Jewish community.
She also urged her people to speak their minds and live freely.
The gunman attacked the free-speech debate hosted by controversial Swedish cartoonist Lars Vilks.
One man - identified by Danish media as film director Finn Norgaard, 55 - was killed and and three police officers wounded.
Officials said the gunman fled by car. A black Volkswagen Polo was found abandoned a short distance away.
Police said the gunman then called a taxi to take him home.
They used information from the taxi driver to identify the address, near the railway station in Norrebro. They released photos showing the alleged attacker wearing a purple balaclava and thick puffer jacket.
Hours later, a gunman opened fire outside a synagogue in Krystalgade street, about 5km from the scene of the first attack, killing a Jewish man and wounding two police officers.
The victim was named as Dan Uzan, 37. He had been on security duty while a bat mitzvah ceremony was taking place inside the synagogue.
Early on Sunday, police said they had been keeping the Norrebro address under observation, waiting for the occupant to return.
When the man appeared, he saw the officers, pulled out a gun and opened fire, police said. They returned fire and shot him dead.
French President Francois Hollande said Interior Minister Bernard Cazeneuve would visit the Danish capital.
US National Security Council spokeswoman Bernadette Meehan said they had been in touch with their Danish counterparts and were ready to help with the investigation.
Israeli Prime Minister Benjamin Netanyahu called on Jewish people in Europe to migrate to Israel following attacks on Jews in recent weeks.
"This wave of attacks will continue. I say to the Jews of Europe - Israel is your home," he told a cabinet meeting.