Norwegian terror suspect Anders Behring Breivik in court.

Norwegian terror suspect Anders Behring Breivik in court. (CNN)

OSLO, Norway -- Anders Behring Breivik, the man who killed 77 people in a bomb attack and gun rampage just over a year ago, was judged to be sane by a Norwegian court Friday, as he was sentenced to 21 years in prison.

Breivik was charged with voluntary homicide and committing acts of terror in the attacks in Oslo and on Utoya Island on July 22, 2011.

The issue of Breivik's sanity, on which mental health experts have given conflicting opinions, was central to the court's ruling.

Breivik, who boasts of being an ultranationalist who killed his victims to fight multiculturalism in Norway, wanted to be ruled sane so that his actions wouldn't be dismissed as those of a lunatic.

He says he acted out of "necessity" to prevent the "Islamization" of his country.

But prosecutors had asked that Breivik, 33, be acquitted on the grounds of insanity, in which case he would have been held in a secure mental health unit.

The unanimous verdict was delivered at Oslo district court by a panel of five judges.

Breivik, dressed in a dark suit and tie, had a slight smile on his face as the decision was given.

He was sentenced to the maximum possible term of 21 years and was ordered to serve a minimum of 10 years in prison.

The sentence could be extended, potentially indefinitely, in the future if he is considered still to pose a threat to society. Norway does not have the death penalty.

Breivik has said he won't appeal the verdict. The chief prosecutor also confirmed Friday that the prosecution does not intend to lodge an appeal.

Bjorn Ihler, a survivor of the Utoya Island attack, told CNN he was glad the trial had concluded and that justice had been done.

"It's been an amazingly difficult process. It's been a constant, constant reminder of why we have to fight extremism in every way possible," he said of the trial.

"We have to make sure nothing like this ever happens again."

The court's judgment that Breivik is sane means that the far-right views he espouses can be confronted in Norway without being dismissed as those of a madman, Ihler said.

"There are extremist people around, they are not insane, and we have to be able to take a proper debate with them," he said.

Asked whether the verdict meant closure for him, Ihler said: "This case is going to live strongly with me for the rest of my life probably."

Reading out the court's ruling, Judge Wenche Elizabeth Arntzen spoke of Breivik's "manifesto," a document published online in which he set out his ultranationalist political views.

Breivik claimed to belong to a far-right group called the Knights Templar but the court found no evidence of its existence, the judge said.