The murder of Ms. Ihle-Hansen, 17, who was adopted from China as a child, was considered a hate crime, as prosecutors argued that there was a racial element to Mr. Manshaus’s decision to kill her.
Mr. Manshaus shot her four times at their family home, then drove to a local mosque, armed with two rifles and one shotgun, and burst through the back door. Before he could shoot anyone, he was tackled and pinned to the ground by two men while a third man called the police.
Irfan Mushtaq, a board member at the mosque, told reporters that the community had been preparing to celebrate Eid al-Adha, a major Muslim holiday, and that an armed attack only one day later could have resulted in many deaths as the mosque would have been crowded with worshipers.
The violence had striking similarities to an attack just months earlier on two mosques in New Zealand by a self-avowed white supremacist, Brenton Tarrant, who live streamed an assault in which he killed 51 people. Mr. Tarrant posted a manifesto online shortly before the attack, outlining his white supremacist views.
During his trial, Mr. Manshaus said he was inspired by Mr. Tarrant’s hate-filled screed. Minutes before storming the mosque, Mr. Manshaus posted his own message in an online forum praising Mr. Tarrant, writing, “It’s been fun” and “Valhalla awaits,” a rallying cry of white supremacists.
The attack echoed another terrorist attack in Norway, in 2011, when Anders Breivik set off a bomb in Oslo and went on a shooting rampage at a political summer camp for young people that left 77 people dead.
Mr. Breivik was also sentenced to 21 years in prison under special detention.
Anne Bitsch, a researcher of militant nationalism, noted the similarities between Mr. Manshaus and Mr. Breivik, and the way they tried to manipulate the justice system.