The gunman suspected of killing two people after opening fire on a free speech debate and a synagogue in Copenhagen on Saturday was identified tonight as 22-year-old Omar Abdel Hamid El-Hussein, a Danish national with a history of gang violence.

Copenhagen Police said the alleged terrorist, who was killed in a shootout with officers in the early hours of Sunday morning, had previously committed “several crimes” including assault and the possession of weapons.

At least two other people were arrested on Sunday, being led out in handcuffs from an internet café in Copenhagen, as part of the police investigation into how the gunman came to arm himself and pick his targets.

Jens Madsen, the head of Denmark’s security service, said he may have been “inspired by militant Islamist propaganda issued by IS [Islamic State] and other terror organisations”. It is not yet known whether he travelled to Iraq or Syria before the attacks.

Shooting at Copenhagen blasphemy event Show all 12 1 /12 Shooting at Copenhagen blasphemy event Shooting at Copenhagen blasphemy event Copenhagen shooting The first tributes are paid outside the Krudttoenden café EPA Shooting at Copenhagen blasphemy event Copenhagen shooting Forensic police officers work at the crime scene AFP Shooting at Copenhagen blasphemy event Copenhagen shooting A CCTV image of the main suspect in the shooting AP Shooting at Copenhagen blasphemy event Copenhagen shooting Prime Minister Helle Thorning Schmidt addressing the media in Oesterbro, a district of Copenhagen AFP Shooting at Copenhagen blasphemy event Copenhagen shooting A police officer is carried into an ambulance after being shot after a public meeting and discussion arranged by the Lars Vilks Committee Getty Images Shooting at Copenhagen blasphemy event Copenhagen shooting Policemen secure the area around a building in Copenhagen, Denmark, where shots were fired AFP Shooting at Copenhagen blasphemy event Copenhagen shooting Bullet holes are seen in the window and door of Krudttonden cafe after shots were reportedly fired during a discussion meeting about art, blasphemy and free speech in Copenhagen EPA Shooting at Copenhagen blasphemy event Copenhagen shooting Police presence is seen at the site of a shooting in Copenhagen Reuters Shooting at Copenhagen blasphemy event Copenhagen shooting The Swedish artist Lars Vilks has lived under police guard since he published a drawing of the Prophet Muhammad with the body of a dog in 2007 GETTY IMAGES Shooting at Copenhagen blasphemy event Copenhagen shooting Francois Zimeray, the French Ambassador to Denmark Shooting at Copenhagen blasphemy event Copenhagen shooting Police presence is seen at the site of a shooting in Copenhagen Reuters Shooting at Copenhagen blasphemy event Copenhagen shooting Policemen search the area where shots were reportedly fired during a discussion meeting about art, blasphemy and free speech in Copenhagen EPA

Police refused to confirm the man’s identity, which was reported by Danish media. The newspaper Ekstra Bladet claimed that El-Hussein had recently been released from prison.

At around 3.30pm on Saturday, the gunman is believed to have opened fire on Copenhagen’s Krudttønden café while a debate featuring the controversial Swedish artist Lars Vilks was being held. Dressed in a heavy winter coat and wearing a maroon mask, witnesses said he fired around 40 shots.

CCTV still issued by Copenhagen Police believed to show the suspect in a shooting at a freedom of speech event (AP)

Film director Finn Nørgaard, 55, who was attending the event, was reportedly shot dead at close range before the gunman escaped in a car, which was later found abandoned. Three police officers were also injured.

More than nine hours later, at around 1am, the same man is thought to have shot 37-year-old Dan Uzan in the head as he guarded Copenhagen’s largest synagogue in a different part of the city. Two more police officers were also injured.

Tributes are laid in front of the synagogue in Krystalgade to the victims of attacks in Copenhagen, which left two people dead (Reuters)

The suspected killer was eventually shot dead as he returned to an address in the city’s Nørrebro district, after exchanging shots with officers who had been lying in wait. Steen Hansen, a spokesman for Copenhagen Police, told The Independent they had little doubt that he was the gunman.

“We are pretty confident that he was the perpetrator,” he said. “But we are still carrying out investigations to make certain, we want to be 100 per cent sure. We still believe that it was a one-man job, but we still have to take the investigation to the end and see what it brings us.”

Mr Steen said that after the first shooting, the gunman had taken a taxi to Nørrebro, where he was active in local criminal gangs. “We know he got a taxi to the area, and then he was seen on surveillance cameras on the area and then he was seen leaving. The police got that information some hours later, and then he came back there early in the morning,” he added.

Denmark's Prime Minister Helle Thorning Schmidt arrives at the synagogue in Krystalgade in Copenhagen (Reuters)

Police also found a weapon in a nearby apartment, believed to belong to the gunman, which he may have used in the first attack. He was carrying two other guns when he was killed.

Later, armed police raided a nearby internet cafe in an operation which they said was connected to the shootings. According to local media, at least two people were arrested.

The Danish intelligence service said it was investigating whether the gunman had been copying the shootings in Paris last month, when 17 people were killed in attacks on the satirical magazine Charlie Hebdo and a kosher supermarket.

Helle Thorning-Schmidt, the Danish Prime Minister, described the killer’s actions as “a cynical act of terror” and said her country had “lived through some hours which we will never forget”. On a visit to the synagogue, where locals left a sea of flowers, she promised that she would do everything possible to protect Denmark’s Jewish community.

“When you mercilessly fire deadly bullets at innocent people taking part in a debate, when you attack the Jewish community, you attack our democracy,” she added.

The victims: a film-maker and a synagogue guard

The prime target of the gunman who terrorised Copenhagen was almost certainly Lars Vilks, the 68-year-old cartoonist who has faced death threats for more than seven years since depicting the Prophet Mohamed as a dog. But instead he killed two others – a film-maker and a Jewish security guard.

Finn Nørgaard

Documentary director Finn Norgaard, 55, who was shot dead at a seminar on free speech at the city’s Krudttoenden cultural centre, was best known in Denmark for Boomerang Boy, a 2004 film about an Australian boy’s dreams of becoming a world boomerang champion. In 2008 he made Le Le, about Vietnamese immigrants in Denmark.

A colleague, Thomas Bartels, said he doubted that Mr Norgaard had been singled out as a target, but was probably a random victim; their last project together was about children whose parents were in prisons, he said. Mr Norgaard was a highly respected film-maker and “a good man loved by his friends”, he added.

Another friend, psychologist Majken Matzau, described Mr Norgaard as “an absolutely incredible, warm-hearted and creative” man.

Dan Uzan

Dan Uzan, 37, was a fluent Hebrew speaker whose family is active in Copenhagen’s Jewish community. He had a degree in politics but had joined patrols to protect Jewish institutions, and was helping to guard the synagogue that came under fire late on Saturday night. He was described by Denmark’s Chief Rabbi, Jair Melchior, as an “irreplaceable” security guard.