DALLAS -- A former Texas police officer testified Thursday at his murder trial that he had no choice but to use deadly force the night he opened fire on a car filled with unarmed black teenagers leaving a house party, killing a 15-year-old passenger. Roy Oliver, who is white, was fired from the Balch Springs Police Department after the April 2017 gunfire that killed high school freshman Jordan Edwards. The shooting was thrust into a national conversation on the killing of African Americans by police.

On Thursday, Oliver told jurors that he decided to fire on the car when he saw it moving toward his partner, Officer Tyler Gross.

Oliver said he thought Gross was in danger, but Gross previously testified that he didn't fear for his life and never felt the need to shoot.

Get Breaking News Delivered to Your Inbox

In the lead up to the shooting, both officers responded to the house party in Balch Springs attended by high-school aged youth. Oliver said he was inside the house when gunshots were fired outside the residence, leading him to believe there was an active shooter. It was later determined that the shots were fired near a nursing home in the area.

Roy Oliver testifies in court on Thursday, Aug. 23, 2018. CBSDFW.COM

Once outside, he said Gross was focused on a car and the tone of his voice had a sense of urgency. Oliver testified he saw the car back up and stop for a second before moving forward and going toward Gross, who had drawn his gun and was ordering the car the stop.

Oliver testified he saw movement from a passenger's silhouette inside the vehicle, and thought Gross had found a shooter or shooters or at least some information on the gunfire. He said a vehicle can be considered a deadly weapon, so he was left with no choice but to fire his rifle.

Oliver testified it was "very sickening" when he realized he had killed the boy.

"I was in shock for days," he said.

Two teenagers who were at the party testified last week that they were across the street when Oliver fired. The teens, Eric Knight and Jeremy Seaton, said they could not see a justification for the gunfire. Seaton said the car was not facing an officer at the time and had steered into the wrong lane of traffic to avoid officers.

The prosecution said all five shots were fired by Oliver after the car had passed Gross.

Philip Hayden, a use-of-force expert called by the prosecution, said Oliver used excessive force when he shot and killed Edwards and testified that a reasonable officer would not have opened fire. But Hayden explained Oliver's decision to fire at the car as excessive and unreasonable, CBSDFW.com reports.

He also rejected Oliver's claim that he used deadly force because the driver of the car was moving toward Officer Gross.

"I did not see any reason why Officer Oliver felt like he had a necessity to fire his weapon at all. I believe there's enough data here to say what happened is Officer Oliver did not have a reasonable belief to use deadly force, and he should not have used deadly force," Hayden told jurors.

Defense attorney Bob Gill told the jury in an opening statement Thursday that the law requires them to view the situation through Oliver's perspective.

Oliver also testified the shooting could have been prevented if one of the bystanders had waved at him and reported the shooters near the nursing home had left the scene.

"It would have changed the outcome," he said.

The defense also asked Oliver about an April 2017 incident in which he was rear ended while off duty and drew his weapon. Police say he pointed the weapon at the ground after the collision. He was later indicted on two counts of aggravated assault tied to the incident.

Oliver, who said he was driving with his wife and young son at the time, testified he did hold his firearm up against his chest during the encounter.