Danish police have shot and killed a man they believe carried out two gun attacks in Copenhagen which left two people dead.
Police said the man was a Danish-born 22-year-old with a background in criminal gangs.
At a news conference on Sunday, officers said video surveillance indicated the man was behind attacks on a free-speech event on Saturday and the capital's main synagogue early on Sunday.
Investigators said the suspect had a history of assault and weapons offences and that they were trying to ascertain if he had help from any accomplices.
The man was shot dead early on Sunday after opening fire on police, officials said, adding that no officers were wounded.
The exchange of fire took place in the multicultural inner-city neighbourhood of Norrebro where police had been keeping an address under observation earlier in the day.
"We believe the same man was behind both shootings and we also believe that the perpetrator who was shot by the police action force at Norrebro station is the person behind the two attacks," police official Torben Moelgaard Jensen said.
Police said there was no evidence to indicate that any more suspects were involved in the incidents.
Intelligence services, meanwhile, said the attacker could have been inspired by last month's attacks on the satirical newspaper Charlie Hebdo.
"From the perspective of the Danish Intelligence service, we can't say anything concrete about the motivation behind the attacks nor the perpetrator's motives," Jens Madsen, Danish intelligence service chief.
"But, we are working on the theory that he could have been inspired by the attack in Paris against the Charlie Hebdo newspaper, Islamic extremism and perhaps other attacks in a similar fashion, he added.
Al Jazeera's Nick Spicer, reporting from Copenhagen, said the suspect was known to Danish intelligence.
Police raids were carried out Sunday evening and an arrest was made at an internet cafe in the neighbourhood where the suspected gunman resided, our correspondent added.
| Talk to Al Jazeera: Yasmine Khadra
Meanwhile, in northern Germany, a police statement said that a carnival parade in Braunscheweig had been called off 90 minutes before it was due to start because of a "specific threat of an Islamist attack".
One man was killed and two police officers wounded at the Copenhagen synagogue, while one man was killed and three police officers were wounded in a shooting attack on a cafe in the north of the capital.
Denmark's Jewish Community identified the victim at the synagogue as 37-year-old Jewish man Dan Uzan, who was guarding a building during a bar mitzvah when he was shot dead at about 1am local time on Sunday morning.
The earlier shooting occurred before 4pm local time on Saturday when police said a gunman used an automatic weapon to shoot through the windows of the Krudttoenden Cafe during a panel discussion on freedom of expression.
The debate on freedom of speech was attended by Lars Vilks, a Swedish artist who had been threatened with death for his cartoons of Prophet Muhammad.
Vilks was whisked away unharmed by his bodyguards but a 55-year-old man attending the event was killed, while three police officers were wounded, authorities said.
Danish Prime Minister Helle Thorning-Schmidt described the two incidents as "terrorist attacks".
"We don't know the motive for the attacks but we know that there are forces that want to harm Denmark, that want to crush our freedom of expression, our belief in liberty," she said in a nationwide address.
"We are not facing a fight between Islam and the West, it is not a fight between Muslims and non-Muslims."
When Vilks is in Denmark, he receives police protection.
A woman in the US state of Pennsylvania got a 10-year prison term last year for a plot to kill him.
In 2010, two brothers tried to burn down Vilks' house in southern Sweden and were imprisoned for attempted arson.
Just over a month ago, 17 people were killed in France in three days of violence that began when two attackers burst into the Paris offices of the satirical weekly Charlie Hebdo , opening fire in revenge for its publication of images of Prophet Muhammad.
Source: Al Jazeera and agencies