The sheriff could have easily justifiably fired him but he didn’t follow the proper process. Everyone wanted their pound of flesh and instant gratification so he and the others were fired without following the legal process to fire a deputy. The legal process is going to involve typically an internal affairs investigation, a notification to the officer that he is being investigated, an internal affairs finding, an recommendation to the Sheriff / Chief, a hearing between the Sheriff and the officer notifying him of the decision, and then a chance for final rebuttal by the officer.
Thats all this is actually about because the sheriff skipped all the steps and went straight to firing which is a violation of civil service and / or contract rules the deputies have.
Before you say the process is flawed then consider in departments without such a process an officer can be fired for arresting a city council members son for domestic abuse and felony drug possession. As actually did happen to an officer (twice) a few years back when he arrested the same son twice in the span of a year. He sued and got his job back for the first and then got fired again after the second arrest.