A man arrested after a break-in at the home of Danish cartoonist Kurt Westergaard is carried into court on a stretcher in Aarhus on Saturday. ((Ernst van Norde/Polfoto/AP))

A Somali man, strapped to a stretcher, was carried into court in Denmark on Saturday to be formally charged with trying to kill a Danish artist whose 2005 caricature of the Prophet Muhammad provoked outrage among Muslims around the world.

The suspect, 28, faces two counts of attempted murder.

Police in the city of Aarhus were called to the home of Kurt Westergaard, 75, on Friday night to confront a man armed with an axe and a knife, said Jakob Scharf, head of Denmark's PET intelligence agency.

The artist, who has received previous death threats, pressed an alarm after the man broke a window and entered his home. Westergaard and his visiting five-year-old granddaughter fled to a specially made safe room.

Officers shot the suspect in the knee and hand when he threatened them with the axe, police said.

The suspect's name was not released in line with Danish privacy rules. A cloth covered his face to conceal his identity as he was wheeled into court in Aarhus, 200 kilometres northwest of Copenhagen.

Police said the man's wounds were serious but not life-threatening.

Westergaard remains a potential target for extremists nearly five years after he drew a caricature of the Prophet Muhammad, a drawing that was published along with 11 others in the Jyllands-Posten newspaper.

Jakob Scharf, who heads the PET intelligence service, said the attempt on the artist's life was "terror related." The suspect is alleged to have ties with the Islamist militant group al-Shabaab in Somalia.

Scharf said the man had been under PET's surveillance but not in connection with Westergaard.

With files from The Associated Press