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 was sentenced Tuesday to four years in prison.

A judge gave Robert Bates, 74, the maximum penalty recommended by jurors who last month convicted the wealthy insurance executive of second-degree manslaughter.

Bates fatally shot Eric Harris on April 2, 2015, while working with Tulsa County sheriff's deputies during an illegal gun sales sting. Harris, who had run from deputies, was restrained and unarmed when he was shot. Harris was black and Bates is white, but Harris' family has said they don't believe race played a role.

The shooting, which was captured on video, sparked several investigations. Among other things, the investigations revealed an internal memo questioning Bates' qualifications as a volunteer deputy and showed that Bates, a close friend of the sheriff's, had donated thousands of dollars in cash, vehicles and equipment to the sheriff's office.

After being sentenced, Bates was led away by deputies. His family members shouted, "We love you! We love you!" as he left court.

Judge Bill Musseman said handing down the prison sentence was a "legitimate and moral consequence" of Bates' actions. He said he took into account Bates' age, failing health and dozens of letters written by community members asking for leniency.

Bates was given credit for the time he has spent in the county jail since being convicted. He must serve nine months of probation after his release.

Defense attorney Clark Brewster said he'll appeal.

"I'm confident we'll get a new audience through the appellate courts, and you'll be interviewing me about the reversal," Brewster told reporters after the sentencing.

The hearing lasted several hours Tuesday, with the judge hearing testimony from Harris' son and the teenager's mother, who said Harris' death "has left a hole" in her heart.

"He made some mistakes; he battled his demons," Cathy Fraley said, but "he always wanted to do the right thing."

Several character witnesses who supported Bates also testified, including his wife, Charlotte, who tearfully asked the judge to give her husband probation and not prison time.

Then Bates, wearing orange jail clothing with his hands shackled, approached Musseman. "I'm very remorseful for what happened," he said.

An outside consultant hired to review the sheriff's office following the shooting determined that the agency suffered from a "system-wide failure of leadership and supervision" and had been in a "perceptible decline" for more than a decade. The reserve deputy program was later suspended.

Weeks after Harris was killed, an internal sheriff's office memo from 2009 was released by an attorney for Harris' family that alleged superiors knew Bates didn't have enough training but pressured others to look the other way because of his relationship with the sheriff and the agency.

A grand jury also investigated the sheriff's office and indicted the longtime sheriff, Stanley Glanz, in September, accusing him of failing to release the 2009 memo. Glanz resigned in November.

The new sheriff sworn into office last month has detailed plans to reform and revive the reserve deputy program.

Glanz, in his letter seeking leniency for Bates, wrote that he didn't believe his longtime friend was "a threat or a danger to anyone and should not be placed in an overcrowded state prison system."

"This is a terrible injustice for a man that made a terrible mistake in a split second," Glanz wrote.