The trial of a 22-year-old Norwegian man accused of murder and terror charges has begun in Oslo.
Philip Manshaus allegedly shot dead his 17-year-old step-sister Johanne Ihle-Hansen last August.
He then opened fire at the Al-Noor Islamic Centre west of Norway's capital, but was quickly overpowered.
He has pleaded not guilty to the terror and murder charges against him, but has admitted the facts of the case are true.
Appearing in court on Thursday, Philip Manshaus told Judge Annika Lindstrom he was invoking "emergency justice" - a defence in Norway that says a person had no choice but to commit a crime, and so cannot be punished.
At one point he launched into a tirade of conspiracy theories, anti-Semitism and homophobia.
Journalists and spectators are watching the trial by video link due to the ongoing coronavirus outbreak.
What is he accused of?
Police accuse him of shooting his step-sister Johanne dead at the family home on 10 August. They say there was a racist motive to the murder.
Johanne Ihle-Hansen was adopted from China when she was just two years old. Her adoptive mother later married Philip Manshaus's father.
The 22-year-old has admitted then taking a number of guns to the Al-Noor mosque in Baerum, near his home. Three people were inside at the time, who managed to overpower him.
The mosque's director said the attacker had gone into the building wearing a helmet and body armour. Several shots were fired but no-one was seriously hurt inside.
A retired Pakistani air force officer, Mohammad Rafiq, was praised for seizing the attacker, pinning him down and taking his weapons from him.
What happened on Thursday?
The 22-year-old told the court he was inspired by the Christchurch terror attack in New Zealand, which killed 51 people.
He said he wished he had "planned the attack better", but said he was "proud to have had the opportunity to fight".
The accused also spouted racist, anti-Semitic and homophobic conspiracy theories before the judge told him the courtroom was "not a pulpit".
In total 30 witnesses will speak at the trial. His father will testify, as will Johanne Ihle-Hansen's mother.