A Montana homeowner who was found guilty of deliberate homicide last year for fatally shooting an unarmed 17-year-old German exchange student who entered his garage was sentenced on Thursday to 70 years in prison.

Markus Kaarma, 30, will not be eligible for parole for the first 20 years of his sentence.

He was convicted in December of killing Diren Dede of Hamburg in a trial that tested Montana’s so-called “castle doctrine” self-defense law, which allows deadly force against a home invasion if a person reasonably believes it is necessary to prevent an assault.

Prosecutor Andrew Paul said on Thursday prior to the sentencing that Kaarma, a former U.S. Forest Service firefighter, had a long history of assaults and domestic abuse, and characterized him as an unpredictable “powder keg.”

At trial, prosecutors painted Kaarma as an armed aggressor who lured Dede to his death while the student was “garage hopping” at night in Missoula, perhaps looking for alcohol.

The Missoula County District Court heard how Kaarma installed motion detectors and a baby monitor days before the shooting, and deliberately left cash and other items in the garage on the day he killed Dede.

Judge Ed McLean said Kaarma’s actions were alarming and stemmed in part from an earlier incident in which marijuana belonging to Kaarma was stolen.

“You weren’t killing to protect your family, you were angry someone stole your grass two weeks before. You were angry with the world,” the judge said.

Wearing shackles and an orange prison jumpsuit, Kaarma said he was sorry for taking another man’s life.

“I did what was necessary and I hope no one else finds themselves in the situation I was in,” Kaarma said.

Prosecutors said Kaarma lost legal protection when he left his house to corner the student in the garage after being alerted to Dede’s presence by the monitoring devices.

Defense attorneys countered unsuccessfully that Kaarma was under no obligation to retreat from an intruder, and that his actions were in line with Montana law.

The defense had called for a new trial, arguing that “prejudicial” media coverage had made it impossible to seat an impartial jury. But McLean rejected that request, and another that Kaarma’s conviction be downgraded from deliberate homicide, during a hearing earlier on Thursday before sentencing.

Defense lawyers said they planned to appeal the verdict to the Montana Supreme Court, but otherwise made no comment.