In this October 27, 2009 file photo, Danish cartoonist Kurt Westergaard sits in the offices of Danish newspaper Jyllands-Posten in Aarhus, Denmark. Image Credit: AP

Copenhagen: Police foiled an attempt to kill an artist who drew a cartoon depicting the Prophet Mohammad (PBUH) that sparked outrage in the Muslim world, the head of Denmark's intelligence service said on Saturday.

Jakob Scharf, who heads the PET intelligence service, said a 28-year-old Somali man was armed with an ax and a knife when he attempted to enter Kurt Westergaard's home in Aarhus shortly after 10pm on Friday.

The man, now under arrest, had "close ties to the Somali terror organisation Al Shabaab as well as to Al Qaida leaders in East Africa,"  the Danish Security and Intelligence Service PET said in a statement.

The man was charged on Saturday with attempting to kill the cartoonist.

Westergaard, 74, was not hurt in the incident, a police spokesman said.

An umbrella organisation for moderate Muslims in Denmark condemned the attack.

"The Danish Muslim Union strongly distances itself from the attack and any kind of extremism that leads to such acts," the group said in a statement.

The attack on the artist, whose rendering was among 12 that led to the torching of Danish diplomatic offices in predominantly Muslim countries in 2006, was "terror related," Scharf said in a statement.

"The arrested man has according to PET's information close relations to the Somali terrorist group, Al Shabaab, and Al Qaida leaders in eastern Africa," he said.

Scharf said without elaborating that the man is suspected of having been involved in terror related activities during a stay in east Africa. He had been under PET's surveillance but not in connection with Westergaard, he said

Police shot the Somali man in a knee and a hand, authorities said. Preben Nielsen of the police in Aarhus said the suspect was seriously injured but his life was not in danger.

It was unclear whether the suspect managed to actually get inside the home of the 75-year-old cartoonist.

Westergaard, who had his 5-year-old granddaughter on a sleepover, called police and sought shelter in a specially made safe room in the house, Nielsen said.

Police arrived two minutes later and tried to arrest the assailant, who wielded an ax at a police officer. The officer then shot the man.

Westergaard could not be reached for comment. He told his employer, the Jyllands-Posten daily, that the assailant shouted "revenge" and "blood" as he tried to enter the bathroom where Westergaard and the child had sought shelter.

"My grandchild did fine," Westergaard said, according to the newspaper's website. "It was scary. It was close. Really close. But we did it."

Westergaard was "quite shocked" but was not injured, Nielsen said.

Westergaard remains a potential target for extremists nearly five years after he drew a caricature of the Prophet Mohammad (PBUH) wearing a bomb-shaped turban. The drawing was printed along with 11 others in Jyllands-Posten in 2005.

The drawings triggered an uproar a few months later when Danish and other Western embassies in several Muslim countries were torched by angry protesters who felt the cartoons had profoundly insulted Islam.