Prosecuting Attorney Bob McCulloch said an off-duty St. Louis County police officer who fatally shot a man in July was justified under the Castle Doctrine. 

According to a statement from McCulloch to St. Louis County Police Chief Jon Belmar, McCulloch ruled the off-duty officer acted within his rights when shooting 20-year-old Tyler Gebhard after Gebhard got into the home by smashing a glass door in the back of the officer's house. The statement said Gebhard "advanced on [the officer] in a threatening manner] before being shot.

Police said it happened just after 5 p.m. July 9 in Lakeshire.

The statement said Gebhard was known the the family of the police officer.

Police said the confrontation began after the intruder smashed open the backdoor of the officer's family's home — while the family was still inside fearing for their lives.

After getting his personal gun from his car, the officer shot at Gebhard, the statement said. The shot grazed the 20-year-old in the neck, and the officer told him to get on the ground. When he refused, the officer shot him twice in the chest. He died at a nearby hospital.

The intruder was able to get into the home but didn't appear to have a gun. There were two young children in the home and they, along with their mother, were hiding in a backroom while the break-in and shooting occurred.

In the days after the shooting a county police spokesperson said Gebhard's family told police he was going through a "mental crisis" at the time of the incident. He had been diagnosed as bi-polar and schizophrenic and recently stopped taking his medication.

The spokesperson called it a "tragedy for both families."

The officer is a 3-year veteran of the police department in his mid-20's. He's was placed on administrative leave pending a full investigation. 

For more information, read the full statement below.

Investigation of July 9, 2016, Shooting Death of Tyler Gebhard