Police shot a Somali man wielding an ax and a knife after he broke into the home of an artist whose cartoon of the Prophet Muhammad with a bomb-shaped turban outraged the Muslim world, the head of Denmark's intelligence agency said Saturday.

Jakob Scharf said in a statement that a 28-year-old man with ties to Al Qaeda entered Kurt Westergaard's home in Aarhus Friday night. But Westergaard pressed an alarm and police arrived minutes later.

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. He said the man would be charged with attempted murder.

Westergaard, whose 5-year-old granddaughter was in the home on a sleepover, sought shelter in a specially made safe room when the suspect broke a window of the home, said Preben Nielsen of the Aarhus police.

Officers arrived two minutes later and tried to arrest the assailant, who wielded an ax at a police officer. The officer then shot the man in a knee and a hand, authorities said. Nielsen said the suspect was hospitalized but his life was not in danger.

The suspect's name was not released in line with Danish privacy rules.

"The arrested man has, according to PET's information, close relations to the Somali terrorist group al-Shabab and Al Qaeda leaders in eastern Africa," Scharf said. PET is Denmark's intelligence agency.

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

The man, who had a permit to stay in Denmark, was to be charged Saturday with attempted murder for trying to kill Westergaard and the police officer, Scharf said.

The suspect got inside the home of the 75-year-old cartoonist in Denmark's second largest city, 125 miles northwest of Copenhagen.

Westergaard could not be reached for comment. However, 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 Web edition. "It was scary. It was close. Really close. But we did it."

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

An umbrella organization 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.

Westergaard remains a potential target for extremists nearly five years after he drew a caricature of the Prophet Muhammad 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.

Islamic law generally opposes any depiction of the prophet, even favorable, for fear it could lead to idolatry.

Westergaard has received death threats and is the subject of an alleged assassination plot.

The case "again confirms the terror threat that is directed at Denmark and against the cartoonist Kurt Westergaard in particular," Scharf said.

In October, terror charges were brought against two Chicago men whose initial plan called for attacks on Jyllands-Posten's offices. The plan was later changed to just killing the paper's former cultural editor and Westergaard.

In 2008, Danish police arrested two Tunisian men suspected of plotting to murder Westergaard. Neither suspect was prosecuted. One of them was deported and the other was released Monday after an immigration board rejected PET's efforts to expel him from Denmark.

Throughout the crisis, then-Prime Minister Anders Fogh Rasmussen distanced himself from the cartoons but resisted calls to apologize for them, citing freedom of speech and saying his government could not be held responsible for the actions of Denmark's press.