PLANT CITY — A former homicide detective who punched and pulled a gun on a schoolteacher during a road-rage incident will avoid criminal penalties through a deal with prosecutors finalized Thursday.

Thomas Pettis, 55, a veteran Hillsborough County sheriff's deputy, will have a battery charge against him dismissed in exchange for his participation in an intervention program that includes 16 hours of community service, anger-management classes and a few hundred dollars in fees, the Hillsborough State Attorney's Office announced.

The punishment is notably less severe than the minimum three-year prison sentence Pettis would have faced if prosecutors had moved ahead with the aggravated assault charge they initially considered.

The abrupt conclusion angered Evan Rees, the 44-year-old high school biology teacher Pettis had attacked. Rees believes Pettis received preferential treatment from the State Attorney's Office because of his standing as a law enforcement officer and because he is a potential witness in dozens of pending homicide cases.

Pettis did not appear in court Thursday when a prosecutor announced the case's closing.

"I feel genuinely ripped off, and this guy's probably sitting at home laughing," said Rees, who took a day off from school and drove more than 70 miles from his home in Sebring in the hope of addressing the judge. "They made a joke out of our justice system right now."

Pettis resigned from the Sheriff's Office after the incident rather than face an internal affairs investigation.

State Attorney's Office spokesman Mark Cox declined to comment on the case because it will not be formally dismissed until Pettis completes his intervention program. If Pettis reneges on any part of the deal, Cox said, the case could be reopened.

The anticlimactic courtroom session was the latest in a series of disappointments Rees says he has met with since his encounter with Pettis three months ago.

Rees and his wife, sister and niece were driving home from the Florida State Fair on the afternoon of Feb. 15 when Pettis rear-ended their car, shattering its back window. According to several witnesses, he and Rees began arguing outside the vehicles, then tumbled to the ground after Pettis — who was not on duty — tried to grab Rees.

After bystanders wrenched them apart, Pettis pulled a handgun from an ankle holster and pointed it at Rees and later pulled out his badge. Some witnesses said he threatened to kill Rees. A few minutes later, he moved through the crowd that had gathered and punched Rees in the head. The latter part of the exchange, including Pettis' drawing his gun, was caught on video by a witness using a cellphone.

Pettis, who at the time was a homicide detective with the Sheriff's Office, was never booked into jail. Threatening another person with a gun is a felony punishable by at least three years in prison, but the State Attorney's Office opted to charge Pettis only with misdemeanor battery. In announcing his decision, State Attorney Mark Ober said Pettis' claim that he pulled the gun in self-defense could not be refuted.

Yet legal experts have said there are problems with Pettis' self-defense claim, including that he initiated physical contact with Rees and that the men had already been separated when he drew his gun.

While Pettis initially denied verbally threatening Rees, he seemed to backtrack in the only statements he has given to the news media, during a television interview he sought out with ABC Action News reporter Sarina Fazan. "If I used the word 'kill,' if I used the word 'shoot' — typically, in a high-stress situation like that, I can see myself saying, 'I will shoot you,' " Pettis said.

Pettis did not return calls from the Tampa Bay Times.

His attorney, Norman Cannella Sr. of Tampa, said he had not seen Pettis' television interview and could not comment on whether Pettis threatened to shoot Rees during the fight.

Cannella said accusations that Pettis got an unusually favorable deal because he was a law enforcement officer "are misplaced and without an understanding of the criminal justice system."

Peter Jamison can be reached at pjamison@tampabay.com or (813) 226-3337. Follow him on Twitter @petejamison.