The gunman killed by Copenhagen police after two deadly shootings had a background in criminal gangs, authorities said Sunday.

Copenhagen police said the 22-year-old man was born in Denmark and had a criminal record, including violence and weapons offenses.  They didn't release his name.

A Danish radio station said the gunman was let out of prison two weeks before the attack, according to The Wall Street Journal.

Police said they had found an automatic weapon that may have been the one the gunman used in an attack on a cultural center hosting a free speech event.

Danish police killed the man early Sunday, who is suspected of carrying out attacks at the free speech event and at a Copenhagen synagogue that left two men dead and five police officers wounded.

More On This...

    Officials said it is possible he was imitating the terror attacks that took place in Paris last month carried out by Islamic radicals at the Charlie Hebdo newsroom and at a kosher grocery store that left 17 dead.

    "Denmark has been hit by terror," Danish Prime Minister Helle Thorning-Schmidt said Sunday. "We do not know the motive for the alleged perpetrator's actions, but we know that there are forces that want to hurt Denmark. They want to rebuke our freedom of speech."

    Jens Madsen, head of the Danish intelligence agency PET, said investigators believe the gunman was inspired by Islamic radicalism.

    "PET is working on a theory that the perpetrator could have been inspired by the events in Paris. He could also have been inspired by material sent out by (the Islamic State group) and others," Madsen said.

    At a news conference Madsen also said the gunman had been on the agency's "radar."

    Later Sunday, at least two people with handcuffs were taken out by police from an Internet cafe in Copenhagen, Danish media reported. Police spokesman Steen Hansen told The Associated Press that "the action was part of the police investigation" but declined to give further details.

    Denmark’s Jewish Community identified the victim of the attack at the synagogue as 37-year-old Jewish man Dan Uzan. He was guarding the building during a bar mitzvah when he was shot in the head. He later died from the injuries sustained in the attack.

    The first shooting occurred Saturday evening at 4 p.m. Police said a gunman used an automatic weapon and shot through the windows of the Krudttoenden cultural center during a discussion on freedom of expression which featured controversial Swedish cartoonist Lars Vilks. Vilks had been threatened previously about his caricatures featuring the Prophet Muhammad.

    Three officers were injured in the attack, but a 55-year-old man died from the injuries he sustained, authorities said.

    The Danish Film Institute said Sunday the man killed was documentary filmmaker Finn Noergaard.

    The institute's chief Henrik Bo Nielsen says he was shocked and angry to find out Noergaard was gunned down while attending a discussion on art and free speech.

    Noergaard directed and produced documentaries for Danish television, including the 2004 "Boomerang boy" about an Australian boy's dreams to become a world boomerang champion and the 2008 "Le Le" about Vietnamese immigrants in Denmark.

    Minutes after midnight Sunday, Uzan was killed and two officers were wounded in the second shooting outside the synagogue.

    Investigator Joergen Skov said the shooter was confronted by police as he returned to an address that authorities were keeping under surveillance. A blurred image was released of his face earlier Saturday.

    Vilks, a 68-year-old artist who has faced numerous death threats for depicting Muhammad as a dog in 2007, told The Associated Press he believed he was the intended target of the first shooting, which happened at a panel discussion titled "Art, blasphemy and freedom of expression."

    "What other motive could there be? It's possible it was inspired by Charlie Hebdo," he said, referring to the Jan. 7 attack by Islamic extremists on the French newspaper that had angered Muslims by lampooning Muhammad.

    Leaders across Europe condemned the violence and expressed support for Denmark. Sweden’s security service said it was sharing information with its Danish counterpart, while U.S. National Security Council spokeswoman Bernadette Meehan said U.S. officials were ready to help with the investigation.

    Israeli Prime Minister Benjamin Nethanyahu decried the attack and is planning to encourage a “massive immigration” of Jews from Europe.

    "Again, Jews were murdered on European soil just because they were Jews," Netanyahu said at the start of his Cabinet meeting Sunday. "This wave of attacks is expected to continue, as well as murderous anti-Semitic attacks. Jews deserve security in every country, but we say to our Jewish brothers and sisters, Israel is your home."

    EU President Donald Tusk predicted the latest acts of violence would only strengthen Europeans' resolve to fight all kinds of extremism and terrorism.

    "We will press forward with our new agreed priorities in the fight against terrorism," Tusk said in a statement late Saturday. "We will face this threat together."

    The EU's law enforcement agency, Europol, said Sunday it was in contact with Danish authorities and proposing its help to find out as much as possible about the Copenhagen gunman and whether he was acting alone or in concert with others.

    "We are offering our expertise and capabilities from our anti-terrorist unit including access to our databases," said Europol spokesman Soren Pedersen.

    Vilks has faced numerous death threats and attempted attacks on his life. He depicted the Prophet Muhammad as a dog in 2007. A Pennsylvania woman received a 10-year prison sentence last year for planning to kill Vilks.

    The depiction of the prophet is deemed insulting to many followers of Islam. According to mainstream Islamic tradition, any physical depiction of the Prophet Muhammad -- even a respectful one -- is considered blasphemous.

    While many Muslims have expressed disgust at the deadly assault on the Charlie Hebdo employees, many were also deeply offended by its cartoons lampooning Muhammad.

    The Associated Press contributed to this report.