OSLO, Norway -- The trial of Anders Behring Breivik ended Friday with the confessed mass killer demanding to be set free and vowing that history would exonerate him for a bomb-and-gun rampage that killed 77 people.

The self-styled anti-Muslim militant got the final word in the 10-week proceedings, but it's unclear whether it helped the main point of his defence: trying to prove that he is sane.

In a rambling statement, Breivik lashed out at everything he finds wrong with the world, from non-ethnic Norwegians representing the country in the Eurovision Song Contest to the sexually liberated lifestyle of the characters in the American TV show "Sex and the City."

Incorporating current events into his statement, he claimed that fellow right-wing extremists were behind a small amount of explosives found outside a Swedish nuclear plant this week. Swedish police spokesman Tommy Nyman had no comment "especially not if he says it."

While some of Breivik's comments prompted laughter in the Oslo court, a serious atmosphere returned when he reiterated his motive for bombing the headquarters in Oslo, killing eight, and hunting down teenagers at the Labor Party's youth camp. Sixty-nine people were dead and dozens more injured in one of the worst peacetime shooting massacres by a single gunman.

"History shows that you have to commit a small barbarism to prevent a bigger barbarism," the 33-year-old Norwegian said.

"The attacks on July 22 were preventive attacks to defend the indigenous Norwegian people," he said. "I therefore demand to be acquitted."

Breivik claims the governing Labor Party has betrayed the country by accepting Muslim immigrants and must be stopped before turning Norway into what he called a "multiculturalist hell."

Earlier Wednesday, defence laywer Geir Lippestad had tried to prove his client is sane -- the key issue to be resolved in the trial since Breivik admits the attacks.

Lippestad also formally entered a plea for acquittal, but it was made out of principle, without any realistic chance of success.

Also Friday, relatives of some of those killed tried to put their loss in words. Kirsti Loevlie, whose 30-year-old daughter Hanne was killed by the bomb, moved the court room to tears when she described the shock of finding out her daughter was dead. The grief of cleaning out her room. The first Christmas without her.

Still, Loevlie said she felt a need to attend the trial, seeing Breivik in a position where he couldn't hurt anyone anymore.

"I am not going to be afraid of this man," Loevlie said. "I decided I would go to court. I felt I owed it to Hanne."

The court room burst out in applause and audible sobs as she finished her statement.

Breivik remained motionless, his face blank.

Lippestad tried to prove to the court that Breivik's claims of being a resistance fighter in a struggle to protect Norway and Europe from being colonized by Muslims are not delusional, but part of a political view shared by other right-wing extremist.

"He realized that it is wrong to kill but he chose to kill. That's what terrorists do," Lippestad said. "The ends justify the means. You don't understand this if you don't understand the culture of right-wing extremists."

When Breivik talks about a civil war he's not fantasizing about tanks and soldiers in the forest, but referring to a low-intensity struggle he believes will last for 60 years, Lippestad said.

"None of us know what Europe will look like in 60 years," Lippestad said. "Who would have thought 10 years ago that a right-wing extremist party in Greece would get 10 per cent in the election now?"

Two teams of psychiatrists reached opposite conclusions about Breivik's mental health. The first team diagnosed him with "paranoid schizophrenia," a serious mental illness. The second team found him legally sane, saying he suffers from a dissocial and narcissistic personality disorder, but is not psychotic.

Prosecutors on Thursday called for an insanity ruling, saying there was enough doubt about Breivik's mental state to preclude a prison sentence.

The five-judge panel will announce its ruling on Aug. 24, chief judge Wenche Elisabeth Arntzen said.

If deemed mentally competent, Breivik would likely be given Norway's maximum prison term of 21 years. A sentence can be extended beyond that if a prisoner is considered a menace to society. If declared insane, he would be committed to a mental institution for as long as he's considered sick and dangerous to others. Prosecutors suggested Thursday that could mean he would be held for the rest of his life.

Lippestad's otherwise focused statement ended on a confusing note when he asked the court for the most lenient possible prison sentence for his client. After being corrected by Breivik, Lippestad said the defence asks for an acquittal or a lenient sentence, but primarily wants the court to reject the insanity claim.