A PROMINENT Danish writer who heads a controversial group that claims free speech is under threat from Islam has escaped an attempt on his life in Copenhagen.

Lars Hedegaard, a well-known historian in Denmark, was able to fend off the attack on Tuesday after the gunman misfired, and was unharmed, police said in a statement.

The incident happened when Hedegaard, 70, opened his front door in the capital's Frederiksberg neighbourhood to a man pretending to be delivering a package and wearing a jacket showing the logo of the Danish postal service.

The attacker "fired a shot with his gun aimed at the victim's head'' but he missed, the statement read.

A struggle then ensued between the two men and the attacker fled the scene, it added.

Hedegaard is the president of Denmark's Free Press Society, an organisation that claims free speech is "being threatened, primarily by religious and ideological interests and international pressure groups.''

"I attacked him and hit him on the head,'' Hedegaard told the daily Politiken about the assassination attempt.

In an earlier statement, police said the gunmen's weapon jammed as he tried to fire off two more shots.

Based on eyewitness descriptions, police said the attacker was a bearded man aged around 25, who was about 1.80 metres tall.

The chairman of the Free Press Society's Swedish arm, Ingrid Carlqvist, who spoke to Hedegaard after the attack, told AFP he described the assailant as someone of "Arab appearance''.

"It's a miracle that he's alive,'' she said.

Carlqvist said she believed the attack was linked to the group's work.

"We view Islam as a totalitarian ideology that is a threat to our way of living,'' she said, adding that the Free Press Society "won't be silenced''.

The society has in the past defended the authors of the controversial caricatures of the Prophet Mohamed, which were first published in a Danish daily in 2005 and sparked violent protests in the Muslim world.