A former Oklahoma volunteer sheriff's deputy who said he mistook his handgun for his stun gun when he fatally shot an unarmed suspect last year has been sentenced to four years in prison.

A judge on Tuesday gave 74-year-old Robert Bates the maximum penalty recommended by jurors. The wealthy insurance executive was convicted of second-degree manslaughter last month.

The courtroom was half-full of Bates' friends and family, some of whom let out audible gasps when the judge handed down the sentence.

Bates accidentally shot and killed Eric Harris last April during a gun sale sting by the Tulsa County Sheriff's Office. Harris was restrained and unarmed at the time of the shooting.

Harris' son, Aidan Fraley, took the stand during the hearing.

"I forgive Bob Bates. I forgive him, but there's still consequences for the actions," Fraley said. "Even if people forgive me and I did something, I still have consequences for them, but I — so I forgive Bob Bates."

Bates’ attorney made two arguments in an attempt to keep him out of prison for his second-degree manslaughter conviction.

Bates has a laundry list of health problems. On the stand, his personal physician of 30 years called prison a death sentence.

"It was a tragic accident, which we all are scarred for life because this man died," said Bates' wife, Charlotte Bates. "To put my husband in prison for four years, my husband will die."

Though the judge said that testimony was compelling, he also said the prison medical system can take care of Bates.

Bates' attorney also crunched 40 years of sentencing data and argued if his client were sent to prison, he'd be the first person convicted of second-degree manslaughter in Oklahoma not to get probation. The judge said Bates' case — a volunteer lawman mistaking his gun for a Taser on a sting he got himself involved in — is an outlier that can’t be looked at that way.

"We were hopeful today that the sentence would allow Mr. Bates to at least not be in virtual seclusion 23 hours a day like a segregation cell that he's going to be put in while we're still fighting for him on appeal," said Bates' attorney, Clark Brewster.

As a former law enforcement officer, Bates will be separated from the general population for his safety. Brewster will appeal Bates' conviction to the Oklahoma Court of Criminal Appeals.

Information from the Associated Press was used in this report