Two police officers were "legally justified" in the deadly shooting of a parent at an Oregon middle school this month, officials said Thursday, as video of the fatal encounter was released.

The Lane County District Attorney's Office said the incident occurred as Eugene police officers Aaron Johns and Steve Timm were trying to arrest 30-year-old Charles Landeros after a custody argument at Cascade Middle School.

Landeros, seen wearing a "smash the patriarchy" shirt in video released by police, refused to leave the premises when asked by school resource officers.

CUSTODY DISPUTE LEAVES ONE PERSON DEAD AT OREGON SCHOOL, POLICE SAY

A struggle later erupted when the officers moved Landeros outside. Lane County District Attorney Patty Perlow said, prior to the shooting, Landeros pulled out a handgun and pointed it at the officers, KPTV reported.

Police officers work the scene where a suspect was shot at a Cascade Middle School in Eugene, Ore, on Friday, Jan. 11, 2019.

Police officers work the scene where a suspect was shot at a Cascade Middle School in Eugene, Ore, on Friday, Jan. 11, 2019. (Chris Pietsch/The Register-Guard via AP)

As the officers tried to wrestle the gun away, Landeros fired two shots. Timm then returned fire, squeezing off a single shot that struck Landeros in the head and killed him, according to officials.

Officials said Landeros was a concealed handgun license holder, and the gun had been legally purchased by his sister-in-law in December. Landeros' daughter and two other people witnessed the shooting, which took place with other students nearby, Perlow said.

“It is unknown why Charles Landeros chose to use deadly force in this circumstance, but he clearly had no regard for the lives of the police officers or the students or staff present, including his child,” the prosecutor said in a statement to the Oregonian.

CLICK HERE FOR THE FOX NEWS APP

Perlow added: “Officer Timm saved the life of Officer Johns, himself and perhaps many others given the number of rounds Charles Landeros had loaded in his weapon. There is no clearer circumstance that the use of deadly force is justified than this."

The Associated Press contributed to this report.