Anders Behring Breivik has been convicted of terrorism and premeditated murder for bomb and gun attacks that killed 77 people and sentenced to a special prison term that would allow authorities to keep him locked up for as long as he is considered dangerous.
Breivik, a self-styled anti-Muslim militant, looked pleased as Judge Wenche Elisabeth Arntzen read the ruling, declaring him sane enough to be held criminally responsible for Norway's worst peacetime attacks.
Lawyers for the 33-year-old Norwegian said before the decision that Breivik would appeal any insanity ruling but accept a prison sentence.
Going against the recommendation of prosecutors, who had asked for an insanity ruling, Arntzen imposed a sentence of "preventive detention", a special prison term for criminals considered dangerous to society.
She set the minimum length of imprisonment to 10 years and the maximum at 21 years, the longest allowed under Norwegian law.
However, such sentences can be extended under Norwegian law as long as an inmate is considered dangerous.
Wearing a dark suit and sporting a thin beard, Breivik smirked as he walked in to the courtroom to hear his sentence and raised a clenched-fist salute.
Breivik, 33, 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 Labour Party's youth wing.
Eight people were killed and more than 200 injured by the explosion.
Sixty-nine people, mostly teenagers, were killed in the shooting massacre on Utoya island. The youngest victim was 14.