A white Indiana police officer who fatally shot a black man, sparking protests and roiling the presidential campaign of South Bend Mayor Pete Buttigieg, has resigned, the local police union announced Monday.

The Fraternal Order of Police said Sgt. Ryan O’Neill’s resignation from the South Bend Police Department was due to stress and media attention given to last month’s shooting of Eric Logan. The union also pointed to “hateful things said on social media.”

SOUTH BEND POLICE CALL OUT BUTTIGIEG FOR SENDING PIZZA RATHER THAN APOLOGY AFTER RACE COMMENTS

“Sgt. O’Neill did his job and was forced to defend his own life from a convicted felon who was armed with an eight-inch hunting knife,” FOP president Harvey Mills said in a release. “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.”

Police Chief Scott Ruszkowski confirmed he received O’Neill’s resignation letter and that his departure was effective immediately.

Authorities have said O’Neill was responding to a report of a person breaking into cars on June 16 and confronted the 54-year-old Logan, and that the officer said he shot Logan after he refused orders to drop a knife.

BUTTIGIEG FACING SCRUTINY AS FAMILY OF BLACK MAN KILLED BY COPS PLANS LAWSUIT AGAINST CITY

A judge has appointed a special prosecutor to investigate the shooting, which authorities said was not recorded by O’Neill’s body camera. Protesters, in the wake of the shooting, have called for police reforms and questioned South Bend’s body camera and use of force policies.

The shooting prompted Buttigieg, who’s seeking the Democratic presidential nomination, to leave the campaign trail for several days to answer questions about public safety and race.

In a statement Monday, Buttigieg said efforts to strengthen trust between law enforcement and community members continue.

CLICK HERE TO GET THE FOX NEWS APP

“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,” he said in the statement.

Logan’s brother, Tyree Bonds, said the family still will pursue a federal lawsuit that alleges O’Neill used excessive deadly force. The city of South Bend is also named in the lawsuit.