Copenhagen, Denmark (CNN) A wary, sucker-punched Denmark kept a high alert Sunday after a gunman attacked a free speech forum featuring a controversial cartoonist, then fired shots near a synagogue before police tracked him down and killed him when he opened fire again.

Two civilians died in the attacks Saturday and early Sunday. Five police officers were wounded, according to Danish authorities.

While the immediate threat seemed to have passed, and investigators stressed there was no evidence yet that the slain suspect had worked with anyone else, police maintained a heavy presence on Copenhagen's normally placid streets. It will stay that way for a while, Danish authorities said, to help residents and visitors feel secure.

As of Sunday night, police still hadn't released the name of the gunman, who they said was wearing clothes similar to the synagogue shooter and had two guns when officers shot him to death early Sunday.

Police did say in a statement that the suspected shooter was a 22-year-old man born in Denmark. He was "well-known by the police for several criminal incidents," according to police.

Those incidents include weapons violations and violence, according to police, who said he also was "known in connection to gangs."

Carsten Ellegaard Christensen, a national security reporter at the Danish newspaper Jyllands-Posten, provided additional details on the suspect, citing sources with detailed knowledge of the investigation.

Christensen was told the dead gunman was Danish-Arab, living in Copenhagen, and was on the radar of authorities for gang activity, not for suspected Islamist extremism. So far as police know, he had not traveled to Syria or Iraq.

The gunman was recently in jail after being convicted of stabbing another young man with a knife several times on board a commuter train, Christensen said. The man survived.

Inspired by Charlie Hebdo attack?

They say they have no evidence he worked with anyone else, but are "operating under a theory" that he may have been inspired by the January terror attack in France, according to Jens Madsen, chief of the Danish Security and Intelligence Service.

Seventeen people died in the Paris attack, which began with an assault on the offices of the satirical magazine Charlie Hebdo. The magazine had published images of the Prophet Mohammed.

In this weekend's attacks, police identified the suspect from surveillance footage that shows him getting into a taxi after the first shooting, Copenhagen police investigator Jorgen Skov said.

Copenhagen police released this photo of a man in connection with Saturday's terror attack.

"By interviewing the taxi driver, we got the address where he dropped off the person," Skov said. "We have been keeping that address under observation."

He said when officers tried to contact the suspect at the Copenhagen apartment early Sunday, the suspect opened fire. Police fired back, killing the gunman.

No officers were injured.

In light of the attacks, Danish Prime Minister Helle Thorning-Schmidt said the country would have to come up with new solutions to the threat of extremism.

JUST WATCHED Danish Prime Minister: 'We are still on high alert' Replay More Videos ... MUST WATCH Danish Prime Minister: 'We are still on high alert' 01:33

"As a nation, we have experienced a series of hours we will never forget," she said Sunday.

"We have tasted the ugly taste of fear and powerlessness that terror would like to create. But we have also, as a society, answered back."

'Everybody, of course, panicked'

The carnage began Saturday afternoon, when the gunman stormed a Copenhagen cafe where Swedish cartoonist Lars Vilks was attending a free speech forum.

Vilks is known for his controversial depictions of the Prophet Mohammed and has been targeted for death by Islamic extremists because of his work.

The man began firing from what police described as an automatic weapon.

"Everybody, of course, panicked in the room and tried to run," professor and satire researcher Dennis Meyhoff Brink said. "We were just hiding ... and hoping for the best."

Brink said he heard about 30 shots around 3:30 p.m. Saturday. He said he also heard someone yelling in a foreign language.

The cartoonist wasn't hurt, but the gunman did kill a 55-year-old man and wounded three officers before fleeing, police said. The man who died in the cafe shooting has not been named by authorities, but the Danish Film Institute said he was director Finn Noergaard.

JUST WATCHED Lars Vilk describes cafe attack Replay More Videos ... MUST WATCH Lars Vilk describes cafe attack 02:47

Vilks told CNN that his bodyguards hustled him into a safe room, where they put him on the floor until the danger had passed. He said it seemed to him that police were surprised by the firepower wielded by the gunman.

"The gunman, he had an advantage because his strong rifle could easily penetrate these glass doors while the policemen's handguns didn't work so well," Vilks said.

The attacker made it just inside the building but apparently got no farther, said Helle Merete Brix, a journalist and founder of the Lars Vilks Committee. The group supports the cartoonist, whose portrayals of the Prophet Mohammed angered many in the Muslim world.

Bodyguards returned fire, Copenhagen police said, but the gunman managed to flee.

Hours later, the man began firing on officers at a Copenhagen synagogue. The officers were wounded, but a man providing security for a confirmation party behind the synagogue died, police and the Jewish Society of Denmark said. The Jewish Society identified him as 37-year-old Dan Uzan.

Photos: Deadly shooting in Copenhagen Photos: Deadly shooting in Copenhagen People look at a makeshift memorial on Sunday, February 15, outside a synagogue where an attack took place Saturday in Copenhagen, Denmark. Danish police shot and killed a man early Sunday suspected of carrying out shooting attacks at a free speech event and then at a Copenhagen synagogue. Hide Caption 1 of 13 Photos: Deadly shooting in Copenhagen Hide Caption 2 of 13 Photos: Deadly shooting in Copenhagen The body of a shooting suspect lies on the pavement, left, as Danish forensic officers examine the scene after police shot and killed the man early on February 15. Hide Caption 3 of 13 Photos: Deadly shooting in Copenhagen Danish police search an apartment in Copenhagen on February 15. Hide Caption 4 of 13 Photos: Deadly shooting in Copenhagen A police investigator works on February 15 at the scene of Saturday's shooting at a free speech event in Copenhagen. Hide Caption 5 of 13 Photos: Deadly shooting in Copenhagen Forensic officers confer near the scene of a shooting Saturday, February 14, in Copenhagen, Denmark. Hide Caption 6 of 13 Photos: Deadly shooting in Copenhagen A victim is carried to an ambulance. Hide Caption 7 of 13 Photos: Deadly shooting in Copenhagen Bullet holes can be seen in the doors of the venue that housed the event. The attackers made it into the lobby but apparently got no farther, according to journalist in attendance. Hide Caption 8 of 13 Photos: Deadly shooting in Copenhagen According to police, the gunmen stormed the Copenhagen building, firing shots before driving away from the scene, police and witnesses said. Hide Caption 9 of 13 Photos: Deadly shooting in Copenhagen The attackers fled the scene in a dark Volkswagen Polo, according to Copenhagen police. Hide Caption 10 of 13 Photos: Deadly shooting in Copenhagen An armed security officer runs down a street near a venue. Hide Caption 11 of 13 Photos: Deadly shooting in Copenhagen Police officers secure the area near the scene. Hide Caption 12 of 13 Photos: Deadly shooting in Copenhagen Emergency personnel gather outside the building where the shooting occurred. Hide Caption 13 of 13

"The Jewish Society is in shock about the attack, but everyone's thoughts are first and foremost with Dan's family and friends, and with the wounded police officers and their families," the Jewish Society said.

Denmark's Queen Margrethe II offered her condolences and urged residents to "stand together and and guard the values upon which Denmark is built."

Cartoon of Mohammed with dog's body

Vilks, who has survived two previous attempts on his life, became a target after his 2007 cartoon depicting Mohammed with the body of a dog -- an animal that conservative Muslims consider unclean.

In a CNN interview later that year from his home in rural Sweden, Vilks said the drawing was calculated to elicit a reaction.

Lars Vilks says his controversial cartoon was calculated to elicit a reaction.

"It should be possible to insult all religions in a democratic way," he said at the time. "If you insult one (religion), then you should insult the other ones."

Like Charlie Hebdo editor Stephane "Charb" Charbonnier -- who was killed in last month's Paris attack -- Vilks was one of nine faces on a "Most Wanted" graphic published by al Qaeda's Inspire magazine for "crimes against Islam."

JUST WATCHED Controversial cartoonist on al Qaeda 'Most Wanted' list Replay More Videos ... MUST WATCH Controversial cartoonist on al Qaeda 'Most Wanted' list 03:03

Others include a pair of Danish journalists who published 12 cartoons depicting Mohammed in the Jyllands-Posten newspaper; Florida pastor Terry Jones, who burned a Quran; and "Satanic Verses" author Salman Rushdie.

Because of that, Brix said, "there's no doubt" the Copenhagen event was targeted because of Vilks, who has "not been able to live a normal life" for years, the Lars Vilks Committee said.

But the Prime Minister stressed that the challenges Denmark now faces were not spawned by a religion at large.

"This is not a battle between Islam and the West, and it is not a battle between Muslims and non-Muslims, but a battle between the values of freedom for the individual and a dark ideology."