Danish agents were warned about gunman Omar El-Hussein
Denmark's domestic intelligence agency (PET) says it was warned by prison officials about the man who killed two people in a shootout in Copenhagen.
It says it received a report in September saying that the man now confirmed by police as Omar El-Hussein, 22, was at risk of being radicalised while serving time for a stabbing.
However, PET said there had been no indication he was planning an attack.
The gunman was shot dead by police after two attacks in the capital.
Swedish cartoonist Lars Vilks, thought to have been the main target of Saturday's initial shooting at a debate on free speech, has said Danish police failed to step up security after January's attack on the offices of Charlie Hebdo magazine in Paris.
But Danish intelligence officials insist they had no cause to suspect El-Hussein was plotting attacks after his release from jail.
Confirming his identity late on Tuesday, police said the gunman had unsuccessfully tried to gain access to several of the entrances of the cultural centre that was hosting the free speech debate.
They say that he encountered his first victim outside the centre and shot him with a weapon subsequently found on a football field at Mjoelnerparken, the housing estate where he was raised.
Two weapons used in the synagogue attack were both found on El-Hussein when he was shot dead.
Danish opposition politicians have called for an investigation into whether police and the intelligence services could have done more to prevent the attacks.
Intelligence chief Jens Madsen acknowledged that El-Hussein had been "on the radar" of his services. He said investigators were working on the theory that he could have been inspired by the shootings in Paris last month.
Lars Vilks told AFP news agency that police "did not step up security on Saturday. It was the same as we had previously", confirming that he had since gone into hiding.
The cartoonist stoked controversy in 2007 by drawing pictures of the Prophet Muhammad dressed as a dog and has been under police protection since 2010.
Omar El-Hussein: From criminal to radical
- Of Palestinian descent, parents settled in Denmark before he was born
- As a youth took up kickboxing and smoked cannabis
- Appears to have been a criminal rather than a radical in his late teens
- Jailed for two years for a 2013 stabbing
- Aged 22 when shot dead by police in Copenhagen
On Monday, tens of thousands gathered in towns and cities across Denmark to commemorate the victims of the attacks.
Two men were charged on Monday with providing and disposing of the weapon used in the attacks and helping the gunman to hide.
However, Prime Minister Helle Thorning-Schmidt said the attacker did not appear to be part of a wider terror cell.
Omar El-Hussein was released from prison two weeks before the attacks after serving a sentence for grievous bodily harm.
Who were the victims?
Finn Noergaard, 55, was struck in the chest by a bullet at the free speech debate. The documentary film-maker had a keen interest in the problems faced by the offspring of migrant communities.
His friend Malene Trock told Berlinske daily he was "open-minded" and "cosmopolitan". Producer Torben Larsen is quoted by the AP news agency as saying Mr Noergaard was "a very generous and warm person".
Dan Uzan, 37, was shot dead while standing guard at a Copenhagen synagogue.
He had studied at the city's university and was a keen basketball player, active in a local team. Denmark's chief rabbi, Jair Melchior, said Mr Uzan was an "amazing guy - irreplaceable".