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.
"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.
"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.
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.
"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.
"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."
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."