Prime Minister Helle Thorning-Schmidt said Denmark would not accept any attempts to threaten or intimidate the country's liberties and rights.

Deadly attacks on a synagogue and an event promoting free speech at the weekend have shocked a nation that is proud of its record of safety and openness.

Two people were killed and five police officers were injured in the attacks which were perpetrated, according to Danish media, by Omar Abdel Hamid El-Hussein.

News broadcaster TV2 said El-Hussein's parents were Palestinian refugees who came to Denmark after living in Jordan for several years.

Thorning-Schmidt told a news conference that there was a conflict between the core values of Danish society and violent extremists.

"And I want to underline that this is not a conflict between Islam and the West. This is not a conflict between Muslims and non-Muslims. This is a conflict between the core values of our society and violent extremists. Collectively and united we will remain who we are," she said.

"The Danish democracy is strong. The Danish nation is strong and we will not accept any attempt to threaten or intimidate our liberties and our rights.

"The freedom of speech and the freedom of assembly are for the Danish people rights and values that we see as fundamental. They are irreversible. And let me be clear: the attack on the Jewish minority in Denmark is an attack on all of Denmark," she added.

Thorning-Schmidt also said the police response on the weekend showed that Denmark had its security "in place".

"And I also want to underline that what we saw on Saturday and in the night between Saturday and Sunday clearly underlines that we have the security in place. It's very clear that when you go into the details of these two attacks that, had we not had the security in place, the situation could have ended up much worse than it did. I am deeply saddened by the loss of two civilians," she said.

The 22-year-old gunman opened fire on a cafe in Copenhagen hosting a free speech debate on Saturday, killing one, and attacked a synagogue, killing a guard.

The man was later shot dead by police in his neighbourhood of Norrebro, a poor and largely immigrant part of the city with a reputation for gang violence.