Officers had an address in the Norrebro area of the Danish city under observation and hailed the man as he approached before he opened fire on them and was shot, police said.
Investigator Joergen Skov told reporters the preliminary probe showed nothing that suggested there were other gunmen involved in the two earlier attacks, in which a man died after being shot in the head near a synagogue and a a 55-year-old man was killed at a freedom-of-speech event.
The second deadly attack took place in the Krystalgade area of the city, with two police officers also shot in the arm and leg and the gunman fleeing from the scene on foot.
A manhunt had already begun for the gunman who opened fire at an event at a Krudttonden cafe, leaving one citizen dead and three police officers injured.
The gathering featured Swedish cartoonist and historian Lars Vilks, who depicted the Prophet Mohammed with the body of a dog in 2007.
In the cafe attack police said both Mr Vilks and French ambassador to Denmark Francois Zimeray, who was also at the event, were both unharmed. The three police officers were also “out of danger”, they said.
Danish prime minister Helle Thorning-Schmidt told reporters in the Danish capital last night: “We feel certain now that it’s a politically motivated attack, and thereby it is a terrorist attack.
“We take this situation extremely seriously. We are in a high alarm all over the country, and our main priority at this stage is to catch the perpetrators and make sure that we find them as soon as possible.”
Prime Minister David Cameron led British condemnation of the attack. He said his thoughts were with the Danish people, tweeting: “I condemn the shootings in Copenhagen. Freespeech must always be protected.”
And Foreign Secretary Philip Hammond tweeted: “Appalled by shootings in Copenhagen. My thoughts are with those affected and their family and friends.”
Deputy Prime Minister Nick Clegg said: “Sickened by shooting at free speech event in Copenhagen. My thoughts are with the people of the city and country.”
Danish police, who initially said they were searching for two suspects, issued a picture of the main suspect taken on street cameras near where the getaway car, a VW Polo, was later found dumped.
Mr Zimeray tweeted from his @FranceDK account shortly after the shooting, writing: “Still alive in the room.”
The cafe in northern Copenhagen was hosting an event titled Art, Blasphemy And The Freedom Of Expression when the shots were fired, according to reports.
It comes little more than a month after the attack on the offices of the French satirical magazine Charlie Hebdo in Paris, which left 12 people dead.
According to larsvilks.com, the event was marking the anniversary of the fatwa against Salman Rushdie. As well as Mr Vilks, Inna Shevchenko from the feminist protest group Femen was also present.
It added that the Lars Vilks Committee, set up to support the cartoonist and freedom of expression, awarded its 2014 freedom prize to Charlie Hebdo last October.
Jodie Ginsberg, chief executive of Index on Censorship, condemned the attack, saying: “The use of violence on a gathering exploring the intersection of religious and artistic freedom should send shivers down our spines.
“The Charlie Hebdo murders inspired intensified public debate about free speech and its value.
“Many people who had previously given little thought to free speech were drawn for the first time into online discussions or attended events to help them get a better understanding of the issues.
“It would be terrible if violent acts such as that in Copenhagen shut down free speech even further.”
“The ability to express ourselves freely, to attend meetings and debates without fear of violence, is fundamental to a free society. Free speech must be protected.”
As police put the area around Krystalgade on lockdown, Sebastian Zepeda, 19, from London, said he did not want to leave his hotel room after hearing of the first shooting and was texting his mother when the second shooting happened in the street below.
“I was on my bed and I heard gunshots. And my heart raced,” he said. “All of a sudden the road was packed with police.”