By Sabina Zawadzki and Ole Mikkelsen
COPENHAGEN, Feb 15 (Reuters) - Danish police shot dead a man in Copenhagen on Sunday during an intensive manhunt after earlier shootings in which two people were killed and five were wounded.
The prime minister said on Saturday the first shooting, which bore similarities to an attack in Paris in January on the office of the weekly newspaper Charlie Hebdo, was a terrorist attack.
One man died in the first attack, on an arts cafe hosting controversial artist Lars Vilks, and another died in an attack on a synagogue close by.
Vilks is a Swede who has been threatened with death for his cartoons of the Prophet Mohammad.
It was not clear if the two attacks were carried out by the same person or people.
Police were unable to apprehend the attacker in both incidents, launching a massive manhunt with helicopters roaring overhead and an array of armored vehicles on the usually peaceful streets of Copenhagen.
By 0500 GMT, police said they had fired shots and later confirmed they killed a man in Norrebro, an area in Copenhagen not far from the sites of the two attacks.
They did not confirm any link between the man they shot and the earlier attacks or give further details. Police officials were not available for comment.
French ambassador Francois Zimeray attended the cafe event and praised Denmark's support for freedom of speech following the January attack in Paris on the Charlie Hebdo newspaper that killed a dozen people.
Witnesses said that the envoy had barely finished an introduction to the meeting when up to 40 shots rang out, outside the venue, as an attacker tried to shoot inside.
Police said they considered Vilks, the main speaker, to have been the target. A 55-year-old man died as a result of that shooting, police said early on Sunday.
"We feel certain now that it was a politically motivated attack, and thereby it was a terrorist attack," Prime Minister Helle Thorning-Schmidt told journalists, speaking on Saturday close to the site of the cafe.
Hours later, during the night, shots were fired at a synagogue in another part of the city, about a half hour walk away from the cafe. A man was shot in the head, and was later confirmed to have died. Two police officers were wounded.
In Paris on Jan. 17, brothers Cherif and Said Kouachi burst into the office of the Charlie Hebdo newspaper and opened fire in revenge for its satirical images of the Prophet Mohammad.
In all, 17 people were killed over three days of violence in France.
European Council President Donald Tusk called Saturday's attack "another brutal terrorist attack targeted at our fundamental values and freedoms, including the freedom of expression."
Helle Merete Brix, organizer 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 itself became a target after the publication 10 years ago 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 Mohammad blasphemous.
Vilks stirred controversy himself in 2007 with his drawings depicting Mohammad as a dog, triggering numerous death threats.
He has lived under the protection of Swedish police since 2010. Two years ago, an American woman was sentenced to 10 years in prison in the United States for plotting to kill him.
French President Francois Hollande said Interior Minister Bernard Cazeneuve would go to the Danish capital later on Sunday. (Editing by Jonathan Oatis and Frances Kerry, Robert Birsel)