OSLO, Norway (AP) – A Norwegian court sentenced Anders Behring Breivik to prison on Friday, denying prosecutors the insanity ruling they hoped would show that his massacre of 77 people was the work of a madman, not part of an anti-Muslim crusade.

Breivik smiled with apparent satisfaction when Judge Wenche Elisabeth Arntzen read the ruling, declaring him sane enough to be held criminally responsible and sentencing him to “preventive detention,” which means it is unlikely he will ever be released.

The sentence brings a form of closure to Norway, which was shaken to its core by the bomb and gun attacks on July 22, 2011, because Breivik’s lawyers said before the ruling that he would not appeal any ruling that did not declare him insane.

But it also means Breivik got what he wanted: a ruling that paints him as a political terrorist instead of a psychotic mass murderer. Since his arrest, Breivik has said the attacks were meant to draw attention to his extreme right-wing ideology and to inspire a multi-decade uprising by “militant nationalists” across Europe.

Prosecutors had argued Breivik was insane as he plotted his attacks to draw attention to a rambling “manifesto” that blamed Muslim immigration for the disintegration of European society.

Breivik argued that authorities were trying to cast him as sick to cast doubt on his political views, and said during the trial that being sent to an insane asylum would be the worst thing that could happen to him.

“He has always seen himself as sane so he isn’t surprised by the ruling,” Breivik’s defense lawyer Geir Lippestad said.

The five-judge panel in the Oslo district court unanimously convicted Breivik, 33, of terrorism and premeditated murder and ordered him imprisoned for a period between 10 and 21 years, the maximum allowed under Norwegian law. Such sentences can be extended as long as an inmate is considered too dangerous to be released, and legal experts say Breivik will almost certainly spend the rest of his life in prison.

It was not clear whether prosecutors would appeal the ruling. If not, and if Breivik sticks to his word not to appeal a prison term, the legal process for one of the darkest chapters in Norwegian history will have come to a close.

Survivors of the attacks and relatives of victims welcomed the ruling.

“I am very relieved and happy about the outcome,” said Tore Sinding Bekkedal, who survived the Utoya shooting.

“I believe he is mad, but it is political madness and not psychiatric madness,” Bekkedal said. “He is a pathetic and sad little person.”

Per Anders Langerod, another shooting survivor said he would like to visit Breivik in prison “and yell at him for 15 minutes.”

“I don’t want to hurt him because I have a problem with violence, now more than ever,” Langerod told the AP. “But I want to yell at him. I want to explain to him what kind of egomaniac mass murderer he is and how he has affected so many people so terribly.”

Wearing a dark suit and sporting a thin beard, Breivik smirked as he walked into the courtroom to hear his sentence, and raised a clenched-fist salute.

Breivik confessed to the attacks during the trial, describing in gruesome detail how he detonated a car bomb at the government headquarters in Oslo and then opened fire at the annual summer camp of the governing Labor Party’s youth wing. Eight people were killed and more than 200 injured by the explosion. Sixty-nine people, most of them teenagers, were killed in the shooting spree on Utoya island. The youngest victim was 14.

In testimony that stunned relatives of his victims, Breivik said he was acting in defense of Norway by targeting the left-wing political party he accused of betraying the country with liberal immigration policies.

Breivik’s lawyers say he is already at work writing sequels to the 1,500-page manifesto he released on the Internet before the attacks. Breivik most likely will be sent back to Ila Prison, where he has been held in pretrial detention. He has access to a computer there but no Internet connection. He can communicate with the outside world through mail, which is checked by prison staff.

They can stop mail encouraging illegal acts or the creation of criminal networks, Ila Prison spokeswoman Ellen Bjercke said.

The impact of Breivik’s violence has been huge. It has forced Norway to accept that terror doesn’t come only in the guise of foreign fundamentalists, but can come from one of their own. The son of a Norwegian diplomat and a nurse who divorced when he was a child, Breivik had been a law-abiding citizen until the attacks, except for a brief spell of spray-painting graffiti during his youth.

The judges noted that Breivik’s extreme anti-immigration views are shared by others, but said it found no evidence that the modern-day crusader network that Breivik claims to belong to, exists.

Norwegian police and government ministers have faced severe criticism for their actions before and during the attacks. The police response was marred by poor communication and technical mishaps. It took police more than an hour to reach Utoya, as a boat carrying the SWAT team was overloaded and stalled in the middle of the lake. Norway’s only police helicopter wasn’t used because its crew was on vacation.

Norway’s justice minister and police chief both resigned in the aftermath and some critics have called on the prime minister to step down.

The judges took turns reading sections of the 90-page ruling, starting with the verdict and sentence, and then going over a chronology of the rampage, victim by victim, and describing their injuries.

Judge Arne Lyng noted that the fertilizer bomb that Breivik set off outside the government headquarters could have been even more devastating.

“It was pure luck that not many more were killed,” Lyng said.

Since his guilt was not in question, Brevik’s sanity was the key issue to be decided by the trial, with two psychiatric teams reaching opposite conclusions. One gave Breivik a diagnosis of paranoid schizophrenia, a severe mental illness that would preclude imprisonment, while the other found him narcissistic and dissocial – having a complete disregard for others – but criminally sane.

More From KIKN-FM / Kickin' Country 99.1/100.5