A white South Carolina police officer on trial for shooting an African-American man in the back—in a video of the killing that has been watched millions of times online—took the witness stand in his own defense and said he was gripped with "total fear."

Michael Slager, a 35-year-old North Charleston officer, is on trial for killing Walter Scott, 50, who was pulled over in April 2015 for a routine traffic stop. Scott, who had a warrant for his arrest, fled the Mercedes-Benz he was driving, was chased into a field, and was then shot and killed as a passerby secretly captured the shooting on video. The footage prompted the police to change their response to the killing, and charges were eventually levied.

"In my mind at that time was, people don't run for a broken tail light. There's always another reason," he testified Tuesday, sometimes in tears. "I don't know why he ran. It doesn't make any sense to me."

"My mind was like spaghetti," the officer said in his self-defense testimony.

Slager faces anywhere from 30 years to life if convicted of murder, and a term of between two and 30 years if convicted of voluntary manslaughter. The monthlong trial continued Wednesday in a Charleston, South Carolina, court. The defense team was unsuccessful earlier in trying to keep jurors from seeing the video that a local man took as he happened upon the scene while he was walking to work.

The officer testified that after the brief chase, a struggle ensued, and he fired his Taser on Scott. Then Scott grabbed his Taser, the officer said. "He rips it out of my hand," Slager testified, adding: "I knew I was in trouble. I was scared.

"I was in total fear that Mr. Scott didn't stop, continued to come towards me," he said.

Feidin Santana, a 24-year-old South Carolina man, came upon the scene and began filming at about this point in last year's confrontation. Santana had said that another police officer on the scene "told me to stop" recording.

After Slager said there was a confrontation over the Taser, Slager said he readied his firearm. "At that point I pulled my firearm and pulled the trigger," he testified. "I fired until the threat was stopped as I was trained to do.

"I didn't know if I hit him. I didn't know if he tripped or fell," Slager said.

Scott was shot five times in the back.

The video shows the officer placing a Taser next to the dead man, whom Slager had handcuffed. He said he wasn't trying to plant evidence, but was following police procedure to take stock of their weapons. "I must have dropped it by Mr. Scott's body. I don't remember doing that," he said.

Closing arguments are expected to begin Wednesday, after which the case will go to the jury for deliberations.

Listing image by YouTube