In a soft, halting voice, a tearful Jason Van Dyke recounted for a rapt jury what was going through his mind as he fired 16 shots at 17-year-old Laquan McDonald four years ago.

The night of Oct. 20, 2014, Van Dyke recalled jumping out of his squad car and locking eyes with McDonald as the teen advanced on him, holding a knife.

“We never lost eye contact. Eyes were bugging out, his face was just expressionless,” Van Dyke said, choking up. “He turned his torso towards me . . . He waved the knife from his lower right side upwards across his body towards my left shoulder.”

“When he did that, what did you do?” defense lawyer Randy Rueckert asked.

“I shot him.”

Van Dyke’s roughly 90 minutes on the witness stand came as his defense team prepared to rest their case Wednesday, and it remains to be seen whether the officer’s risky decision to take the stand helped his cause in a case that will hinge on whether jurors believe Van Dyke was justified in shooting McDonald.

Statements Van Dyke made to his partner as they drove to the intersection of South Pulaski Road and 41st Street — which were made public for the first time in testimony by a psychologist who interviewed Van Dyke for the defense — may have proved more damaging than anything the officer said on the stand.

Talking to Florida-based psychologist Laurence Miller a few months after he was charged, Van Dyke, 40, said when he heard over a police radio that McDonald had stabbed the tire and windshield of a police cruiser, Van Dyke said to his partner, “Why didn’t they shoot him if he’s attacking them?”

As they pulled within two blocks of McDonald, before Van Dyke had laid eyes on the teen, he remarked, “Oh my God, we’re going to have to shoot the guy.”

Van Dyke’s trip to the witness stand came after the testimony of Miller, who went on at length about how the brain forms memories and how that process is distorted in high-stress, traumatic situations. Van Dyke, he said, could have suffered from “time distortion” and likely reacted out of reflex when he opened fire.

The questions lobbed at the psychologist by Van Dyke’s lawyers seemed intended to explain the memory lapses and inconsistencies with what Van Dyke said he did and how events appear to play out on police dashboard camera video. Asked if a “reasonable” officer would have done what Van Dyke did, Miller offered a qualified response.

“A reasonable officer, faced with the perceptual reality of what Officer Van Dyke was experiencing? The answer would be yes,” Miller said.

Van Dyke conceded that his recollection of the shooting was flawed: on cross-examination by Assistant Special Prosecutor Jody Gleason, he said he told detectives that night that he had backpedaled as McDonald approached, but video showed him taking several steps toward the teen.

“Yeah, I thought I did (back up),” Van Dyke said. “But today, after seeing the video countless times, I know I did not backpedal.”

The video, and an animated re-creation of the shooting prepared by the defense, also did not show McDonald raising the knife over his shoulder, as Van Dyke testified.

“In that video, it may not show it, but that wasn’t from my perspective,” he said. “I was coming at it from a completely different angle.”

Van Dyke also insisted McDonald tried to get up after he struck the ground after the first shots. The video did not capture this either.

“I could see him start to push with his left hand off the ground, I could see his left shoulder start to come up,” he said. “I still see him with that knife in his right hand. His eyes are still bugged out, his face, no expression in it.”

Van Dyke said he continued firing at McDonald, aiming for the knife in his hand.

“I just kept on looking at the knife, and I shot at it,” he said. “I just wanted him to get rid of that.”

Van Dyke also said he fired the shots in two volleys: one as McDonald approached him and his partner, and a second after McDonald was on the ground. Asked how many additional shots he fired after McDonald was on the ground, Van Dyke was uncertain.

“I think I fired two or three shots,” he said.

Veteran defense lawyer Richard Kling summed things up simply after Van Dyke’s testimony ended.

“How he’s perceived by the jury is going to make all the difference in the world,” Kling said.

Alan Tuerkheimer, an attorney and jury consultant at Chicago-based Trial Methods, said Van Dyke “showed the right amount of human emotion” on the stand but might have lost points with the jury when he got flustered with prosecutors.

Still, Van Dyke gave jurors a “narrative that people can embrace.”

“I don’t know if jurors are going to accept his entire testimony,” Tuerkheimer said, “but I do think it was important for him to take the stand.”

Van Dyke’s testimony fell flat with the Rev. Marvin Hunter, McDonald’s great uncle, who said he hoped to hear “real compassion” from the veteran officer.

Standing in the lobby of the courthouse, flanked by the Rev. Jesse Jackson, Hunter said, “the reality is that I believe not one word that Jason Van Dyke said today. Not one word.”

But Fraternal Order of Police President Kevin Graham said Van Dyke “gave a very honest, unrehearsed account of what he saw that night.”

“And I think that’s important to realize that, because what the law looks at is what he saw, in his eyes, and what he was afraid of, and what he had to combat,” Graham said.