A man who admitted earlier this year that he attacked a longtime friend with a hammer has been given a chance to avoid spending time in prison.

District Judge Catherine Wilking on Thursday sentenced 28-year-old David Keith Taylor to three years of supervised probation with an underlying, suspended prison sentence of six to eight years.

Taylor pleaded guilty in March to a single count of aggravated assault as part of a plea agreement. In exchange, prosecutors agreed to recommend that Taylor serve no more than five years in prison.

Court documents alleged that in late November, Taylor hit an Edgerton man in the head with a hammer. Taylor had been invited to the victim's home.

The victim initially told authorities that Tayor had tried to force a hug upon the victim, and became physically aggressive when the victim rebuked him.

Taylor ended up hitting the victim in the head with a framing hammer.

Assistant District Attorney Mike Schafer on Thursday recommended that Wilking sentence Taylor to a prison term of three to five years, despite a recommendation from Probation and Parole that Taylor receive a sentence of probation.

Schafer presented a number of aggravating factors: the violence of the incident itself, Taylor's previous failures on probation and the fact that Taylor had previously continued to abuse drugs and alcohol while on probation.

Although this case marked Taylor's first felony charge, Schafer said Taylor previously faced two DUI charges in addition to a battery charge in 2008 and a charge of fighting in public in 2013.

"This was not a situation of self-defense," Schafer said of the November incident. He also presented Wilking a photograph of the victim's injuries in order to show the seriousness of the hammer strike, emphasizing that it was not a "glancing blow."

Public defender Curtis Cheney, in recommending that Taylor receive a probationary sentence as recommended in the presentence investigation report, told Wilking that Taylor is not a violent person. He described how the facts of the case had "evolved" since the night of the assault.

Cheney explained that after some time, the victim spoke with investigators and told them that the assault did not actually stem from a forcible hug. Rather, the three men at the victim's home that night had been making a methamphetamine pipe before the assault occurred.

Cheney also told Wilking that the victim had refused to cooperate with investigators, nor did he work with the Natrona County District Attorney's Office to establish an amount of restitution. That, Cheney said, could indicate that the victim "isn't too concerned" about the case and its outcome.

"To say I feel bad is about this is an understatement," Taylor told Wilking when given the opportunity to speak. He described the victim as a longtime family and personal friend.

Taylor went on to detail how he began drinking more alcohol after his mother passed away in July, and said that he would benefit from a sentence structured to provide substance abuse treatment.

Before pronouncing Taylor's sentence, Wilking said it was difficult for her to decide whether to send Taylor to prison or give him a chance at probation. She acknowledged that Taylor had demonstrated his struggles with alcohol but also said she was "very troubled" by his previous lack of compliance with probationary terms.

Wilking ordered that Taylor, as part of his probation, complete an inpatient treatment program to be followed by the felony program at the Casper Re-Entry Center. She ordered Taylor held in custody at the Natrona County Detention Center pending his acceptance into a treatment facility.

Wilking also ordered that Taylor be monitored for alcohol consumption, and gave him two options to comply with that monitoring: either wear a bracelet that can detect the presence of alcohol in his system -- and pay for the device out of his own pocket -- or participate in the 24/7 program offered by the Natrona County Sheriff's Office, which would see Taylor tested twice each day.

"When you say you're not a violent person, that isn't borne out by [the photograph of the victim's injuries]," Wilking told Taylor. She emphasized that she will not tolerate any probation violations, saying that any proven lapses would "very likely" see Taylor sent off to serve the prison term.