TULSA, Okla. — A former volunteer sheriff’s deputy in Oklahoma who said he mistook his handgun for his stun gun when he fatally shot an unarmed suspect last year was sentenced on Tuesday to four years in prison.

Judge Bill Musseman gave the deputy, Robert C. Bates, 74, a wealthy insurance executive, the maximum penalty recommended by jurors who last month convicted him of second-degree manslaughter.

Mr. Bates fatally shot Eric C. Harris on April 2, 2015, while working with Tulsa County sheriff’s deputies during an illegal gun sales sting. Mr. Harris, who had run from deputies, was restrained and unarmed when he was shot.

The shooting, caught on video, led to several investigations. The inquiries revealed an internal memo questioning Mr. Bates’s qualifications and showed that Mr. Bates, a close friend of the sheriff’s, had donated thousands of dollars in cash, vehicles and equipment to the sheriff’s office.