Mayor Pete Buttigieg of South Bend, Indiana, said at Thursday night's Democratic presidential debate that his city's police force remains disproportionally white "because I couldn't get it done."

Buttigieg has faced criticism from community leaders and heckling from hometown audiences since a white South Bend police officer shot and killed Eric Logan, a black man who was allegedly armed with a knife, on June 16.

The officer's body camera wasn't turned on during the incident. St. Joseph County prosecutors are investigating, and Logan's family filed a federal civil rights lawsuit against the officer and the city on Wednesday.

Buttigieg said during the debate in Miami that he couldn't "take sides" in the Logan case until the investigation is complete, but he acknowledged, "It's a mess, and we're hurting."

"I could walk you through all of the things that we have done as a community, all of the steps that we took, from bias training to de-escalation, but it didn't save the life of Eric Logan," he said. "And when I look into his mother's eyes, I have to face the fact that nothing that I say will bring him back."

Buttigieg blamed "the shadow of systemic racism" for what he called "a wall of mistrust put up one racist act at a time" between police and the communities they serve.

"It threatens the well-being of every community, and I am determined to bring about a day when a white person driving a vehicle and a black person driving a vehicle, when they see a police officer approaching, feels the exact same thing: a feeling not of fear but of safety," he said.

Another candidate on the stage, Rep. Eric Swalwell of California, challenged Buttigieg, saying the mayor should fire the police chief because the officer didn't have his body camera on.

When Buttigieg tried to explain how state law limited his options, Swalwell jumped in and said: "But you're the mayor. You should fire the chief if that's the policy and someone died."

When asked about the lack of diversity on his city's police force on MSNBC's "Morning Joe," he said it remained a "top priority" for him.

Buttigieg said he was proud of the diversity at the top of commission in charge of hiring and firing police officers. "When it comes to the rank and file this has been a huge struggle," he said.

He added that during his time as mayor he has done work in schools to try to recruit diverse law enforcement from early in life and engaged with behavioral researchers to see what kinds of messages "diverse candidates will respond to more."

"I'm going to own up to the fact that we haven't gotten there and we're going to look at what the cities that have been the most effective at this have done, because clearly there's something else that we could be doing that we haven't hit on yet," he said.

Buttigieg has occasionally left the campaign trail in the last few weeks to address the Logan shooting at home. At a chaotic town hall Sunday, an attendee shouted at him, "You are lying!" and another said, "We don't trust you."

Buttigieg, now in his second term as mayor, has also been under pressure over his demotion in 2012 of the city's first black police chief, Darryl Boykins, who had ordered the taping of the telephone calls of senior police officers who he alleged had made racist comments about him.

Buttigieg said he demoted Boykins because the chief failed to disclose that the FBI was investigating him for allegedly having wiretapped subordinates inappropriately.

Litigation, which has been ongoing for six years, has cost the city more than $2 million, the South Bend Tribune reported.