Denmark's domestic intelligence service has admitted prison officials alerted the agency last year to the gunman in last weekend's shootings in Copenhagen that killed two people and wounded five.

The Danish Security and Intelligence Service, known by its Danish acronym PET, said the report in September did not give any reason to believe the 22-year-old was planning an attack.

PET also said it did not have any intelligence before the gunman's shooting sprees at a cultural centre and synagogue that an attack was imminent.

Gunman Omar Abdel Hamid El-Hussein was released from jail about two weeks before the attacks after serving time for a stabbing attack.

El-Hussein was arrested 15 months ago for a knife attack on a train passenger. While he was awaiting trial, a change in his behaviour last summer set off enough "alarm bells" for jail authorities to alert PET, a source said.

Such warnings usually set in motion counter-radicalisation efforts, such as counselling in jail.

It was not immediately clear how aware the court was of this issue before El-Hussein was convicted of a lesser charge.

Sentenced to the time he had already served, he was released about two weeks ago, the source said.

"We are working on finding out what has happened," PET spokeswoman Lotte Holmstrup said.

The agency's director, Jens Madsen, has confirmed the agency had been aware of the gunman and that El-Hussein might have been inspired by last month's attacks by Islamic extremists in Paris which killed 17 people.

He opened fire at a cultural centre and a synagogue - targets that resembled the Paris attackers' rampage at the Charlie Hebdo newspaper and a Jewish grocery store - before he was killed in a gun battle with a SWAT team early on Sunday.

His victims included Danish documentary film-maker Finn Norgaard and a Jewish security guard, Dan Uzan, while five police officers were wounded.

Denmark's prime minister and crown prince and foreign dignitaries joined about 30,000 people honouring the victims on Monday night outside the Krudttoenden cultural centre.

A judge ordered 10 days of pre-trial detention for two people accused of helping El-Hussein get rid of a weapon while evading authorities.

Both men deny the charges, said Michael Juul Eriksen, a defence lawyer for one of the two.