The white Indiana police officer who fatally shot a black man last month — causing Democratic presidential candidate Pete Buttigieg to briefly return home — has resigned.

Fraternal Order of Police president Harvey Mills confirmed Sgt. Ryan O’Neill’s departure from the South Bend Police Department, saying in a release that the officer “did his job and was forced to defend his own life from a convicted felon who was armed with an eight-inch hunting knife.”

“We’re confident that the investigation into the shooting will determine that the action he took was justified based on the law and his training.”

O’Neill was responding to a call about a suspicious person going through cars on June 16 when he confronted 54-year-old Eric Logan, who was inside a vehicle, authorities said.

Logan, who was armed with a knife, was shot by O’Neill after he refused to drop the weapon.

The next day, Buttigieg, the mayor of South Bend, abandoned the presidential campaign trail and returned to the city to address the police-involved shooting.

In a Monday statement, Buttigeig said, “We will await results of the independent criminal investigation, and apply any lessons learned to our work on the future of the Police Department and the community.”

With Post wires