MISSOULA, Montana (AP) — A man wasn't defending his family but rather hunting someone when he shot and killed a German exchange student who was trespassing in his garage, a judge said Thursday as he sentenced the man to 70 years in prison with no parole possible for at least 20 years.

Kaarma's case was closely followed in Germany and brought scrutiny in the U.S. to Montana's "stand your ground" law that allows the use of force to protect life and property. At least 30 U.S. states have such laws.

In sentencing Kaarma, the judge made clear there are strict limits to residents' rights to use force while claiming self-defense.

"Here you have a 12-guage shotgun, not to protect your family but to go after someone. And go after someone you did," District Judge Ed McLean said sternly in sentencing Markus Kaarma for deliberate homicide in the April 27 killing of 17-year-old Diren Dede of Hamburg, Germany.

"You pose too great a risk to society to be anywhere else but the Montana State Prison," McLean said. "Good luck to you, son."

Kaarma's attorneys plan to appeal. They argued he feared for his life, didn't know if the intruder was armed, and was on edge because of the earlier burglary. Kaarma was convicted in December, and he had faced a maximum prison term of 100 years.

At trial, they invoked Montana law allowing people to use deadly force to defend their property. That law was expanded in 2009 to allow the use of force even in cases that don't involve violent entry.

But Kaarma had to demonstrate he was reasonably fearful for his safety. The jury concluded he was not.

In a similar case, a Minnesota man was convicted in May of lying in wait in his basement for two teenagers and killing them during a break-in.

Florida's "stand your ground" law allows the use of deadly force in more circumstances outside the home. It, too, was widely scrutinized in the 2012 shooting of an unarmed teenager, Trayvon Martin, by George Zimmerman, a neighborhood watch volunteer who was following the 17-year-old. Zimmerman was acquitted after arguing self-defense.

Germany does not have a similar law, which was part of the reason Kaarma's case attracted so much attention there.

At trial, prosecutors argued Kaarma was intent on luring an intruder into his garage after it was burglarized at least once before the shooting. Three witnesses testified they heard Kaarma say he'd been waiting up nights to shoot an intruder.

The night of the shooting, Kaarma left his garage door partially open and placed a purse inside. Alerted by a motion detector, he entered the darkened garage and fired four shotgun blasts, pausing between the third and fourth shots, witnesses testified.

Lead detective Guy Baker testified that the first three shots were low and seemed to follow Dede as he moved across Kaarma's garage. The fourth shot was aimed higher and struck Dede in the head, Baker said.

Dede was unarmed.

"It is justice," Dede's father, Celal Dede, said after the sentence. But he added: "I am not happy. My son is dead."

Kaarma sat staring down during much of the proceeding, occasionally glancing around the crowded courtroom. He sported buzz-cut, dark hair and an orange jail suit.

"I'm sorry my actions caused the death of Mr. Dede," he told the judge.