The trial of Anders Behring Breivik ended Friday, exactly 11 months after he massacred 77 people in Norway, with the confessed killer insisting his attacks were justified and demanding acquittal.

The court announced that the verdict would be issued on August 24, while Breivik used the 45 minutes accorded to him for final remarks in the 10-week trial to claim his attacks were necessary to defend Norway against multiculturalism and a "Muslim invasion".

"The July 22 attacks were preventive attacks in defence of my ethnic group and I can therefore not acknowledge guilt," said the 33-year-old right-wing extremist.

"I was acting on behalf of my people, my religion and my country. I therefore demand that I be acquitted," Breivik said.

On July 22, 2011, Breivik first set off a car bomb outside government buildings in Oslo, killing eight people, before going to Utoeya island, northwest of the capital where he shot and killed another 69 people, mostly teenagers.

The victims, the youngest of whom had just celebrated her 14th birthday, had been attending a summer camp hosted by the governing Labour Party's youth organisation.

Before Breivik made his final remarks Friday, many survivors of his attacks and family members of his victims stood up and left the Oslo courtroom in protest.

"He has a right to talk. We have no duty to listen," Christian Bjelland, the vice chair of the support group for the attacks' survivors and victims' families, told the NTB news agency.

After more than 30 people filed out of the courtroom, Breivik plunged into a rambling, ideological speech, among other things blasting US television series "Sex and the City" for encouraging women not to establish families and singers of immigrant origin representing Norway in the Eurovision Song Contest.

Addressing the five Oslo district court judges, he said: "the judges sitting here today can judge me as they wish."

But "history will show whether they judge a man who tried to stop evil," he said, insisting he "carried out a small barbarism to stop a greater barbarism."

Shortly before Breivik took the stand, the Oslo district court heard heart-wrenching testimony from five people who lost a loved one in the July 22 attacks.

"To inherit your child's cups and plates, is just crazy," Kirsti Sofie Loevlie said, recalling how painful it had been to go through her 30-year-old daughter Hanne's apartment after she was killed in the Oslo bombing.

"This is my trial. I am sure the court will give a correct verdict ... He will never get out again. I will not spend much time and effort on this man," she said, prompting loud applause from the courtroom.

Utoeya survivor Lara Rashid, whose elder sister Bano was killed on the island, meanwhile drew sobs from onlookers when she spoke of her pain at knowing her sister would not be there on her wedding day, to see her children, or for the confirmation of their younger brother.

"The day she died, I died too," she said.

Earlier Friday, Breivik's main defence lawyer Geir Lippestad rejected the prosecution's call for his client to be locked up in a psychiatric institution and that he be given the "mildest possible" prison term.

Though there is no chance Breivik will be acquitted, the defence lawyer was also formally obliged to request that he be set free since he has pleaded not guilty, evoking the "principle of necessity".

Yet with no illusion of getting his client off, the defence focused mainly on trying to show Breivik is sane and should be locked up in prison, not a psychiatric ward as requested by prosecutors.

Psychiatric evaluations of Breivik's mental health have sharply contradicted each other, with two court-appointed expert teams reaching diametrically opposed conclusions.

Breivik himself is intent on proving his sanity to establish that his far-right, Islamophobic ideology is not just the rantings of a lunatic.

Prosecutors argued Thursday that Breivik's sanity had not been proven beyond a reasonable doubt, referring to the first court-ordered exam that found him to be suffering from "paranoid schizophrenia" and an uncontrollable urge to violence.

"Our request is that he be obliged to undergo psychiatric treatment" in a closed unit, prosecutor Svein Holden said, stressing that "in our opinion, it would be worse to sentence someone who is psychotic to prison than to send someone who is not psychotic to psychiatric care."

Lippestad countered Friday that "it is just as bad to treat a healthy individual (in a psychiatric ward) as to not treat someone who is ill."

He spent much of his closing argument attacking the first psychiatric report, seeking instead support in the second report that found Breivik sane to show his client was a political extremist, not psychotic.

If found criminally sane, Breivik, who has been charged with committing acts of terror, will likely be sentenced to Norway's harshest penalty: 21 years in prison, with the possibility of extending the sentence for as long as he is considered a danger to society.