A Liberty University security officer will not be charged in the fatal shooting of a student who attacked him with a hammer in November, according to prosecutors in Lynchburg, Va.

Deputy Commonwealth’s Attorney Jeffrey Bennett ruled that the officer, A.S. Mulberry, acted in self-defense when he fired two shots at Liberty freshman Joshua Hathaway on Nov. 19 at an off-campus dormitory known as Residential Annex II. Hathaway, 19, swung at Mulberry with a short-handled metal sledgehammer, making Mulberry fear for his safety, according to Bennett’s report.

“Mulberry’s belief that he was in imminent danger of death or serious harm was reasonable,” Bennett wrote.

The early-morning attack, at an all-women’s dorm, shocked the evangelical university and left the campus community searching for answers. According to the report, several witnesses said Hathaway was struggling with depression, had financial problems, was not sleeping at night and often had cuts or other injuries to his face. But it is was unclear why he would attack Mulberry.

University officials declined to comment on the report.

According to Mulberry’s account, Hathaway entered the dorm’s lobby about 4 a.m. and said that he had been mugged and that his car had been stolen. The officer, who was at a front desk in the lobby, noticed a cut on Hathaway’s head and radioed for a medic and police officer.

After ignoring Mulberry’s suggestion that he sit down and wait for medical assistance, Hathaway allegedly pulled the hammer from under his shirt and tried to hit Mulberry with it, leading to a scuffle that sent the two men to the floor.

After Hathaway reached for Mulberry’s gun as he climbed on top of the officer, Mulberry shoved him off and shot him twice, the report says.

Police officers and Lynchburg Fire Department medics performed CPR and first aid on Hathaway, but he died at the scene. Mulberry was transported to Lynchburg General Hospital with minor injuries, including a bleeding lip and abrasions on his face and hands.

A medical examiner ruled Hathaway’s death a homicide and said he had found no alcohol or drugs in his system. Officers found Hathaway’s blood on a knife recovered from his pants pocket and in stains near Hathaway’s car, which was parked in a lot outside the dorm.

Bennett suggested that Hathaway’s facial wound was ­self-inflicted.