(CNN) -- A Danish court sentenced a Somali man to nine years in prison Friday for the attempted attack on a cartoonist who drew an image of the Muslim prophet Mohammed wearing a bomb-shaped turban.
Mohamed Geele will be permanently expelled from Denmark when his prison term is complete, according to the sentence.
Prosecutors had sought 12 years in prison for Geele.
"This is a good result, and I am very pleased with the way that it has gone," District Attorney Kristen Dyman said.
Geele was convicted Thursday of attempted terrorism, attempted manslaughter and attacking a police officer with a knife and an ax, according to prosecutors.
Authorities said Geele tried to break into the home of cartoonist Kurt Westergaard on January 1, 2010. He cracked a window, which set off an alarm and sent police to the home. An officer shot Geele in the hand and leg.
Westergaard, who was home with his 5-year-old granddaughter at the time of the break-in, hid in a "panic room" when he realized what was happening, authorities said. Westergaard is ordinarily accompanied by bodyguards when he leaves his home, but nobody was on guard at the house that day, the Security and Intelligence Service told CNN.
Danish intelligence officials linked Geele to an East African Islamist militia allied with al Qaeda. Although Geele had been under surveillance because of his alleged terrorist associations, Danish authorities said they had no idea Geele was planning an attack on Westergaard.
The cartoonist has said he wanted his controversial drawing to show that some people exploited the prophet to legitimize terrorism. However, many in the Muslim world interpreted the drawing as depicting their prophet as a terrorist.
CNN's Alexander Felton contributed to this story.