A South Dakota sheriff who lost his re-election bid to his own deputy in a landslide wasted no time getting back at his former employee.

One minute after polls closed, Bon Homme County Sheriff Lenny Gramkow fired Deputy Sheriff Mark Maggs, who won by 878-331.

In a June 5 letter dated 7:01 p.m., moments after the Republican primary closed, Gramkow sent a biting message to Maggs in all caps.

“Mark Maggs: This letter is to inform you that effective immediately you are terminated from the position of Deputy Sheriff for Bon Homme County,” Gramkow wrote. “As of this moment you are no longer an employee of Bon Homme County. Please turn in all equipment belonging to Bon Homme County by 5 p.m. on June 6, 2018.”

Maggs posted a picture of the termination letter to Facebook along with the caption, “Here’s the Integrity of Lenny Gramkow.”

South Dakota is an employment-at-will state where employers can fire subordinates without cause, according to the Associated Press. State sheriffs also have authority to hire and fire employees.

Maggs’ platform included addressing the growing drug problem in the county with promises to add a K-9 division to the police department.

No other Democrats or Independents have declared their run for the position and, should a challenger not arise, Maggs will assume office in January. In the meantime, he is unemployed.

The Bon Homme County Sheriff’s Office told The Post it did not have a comment at this time. Gramkow declined to comment in a phone call.

Calls to Maggs were not returned.