Chilling surveillance footage shows a crazed man pulling out a knife before he allegedly stabbed an LA high school student to death.

Video released by the Los Angeles Police Department shows the suspect walking through a parking lot on Valley Boulevard in the LA neighborhood of El Sereno last week and pulling out a large blade.

The man — identified by authorities as David Zapata, 32 — brandishes the knife in both hands and takes an aggressive stance before the video cuts off.

Zapata then allegedly killed 17-year-old Xavier Chavarin, described by family as a straight-A student at nearby Woodrow Wilson High School, about 4 p.m. Friday, the LA Times reported.

The attacker allegedly stabbed another person several hours later but the victim survived, police said.

Surveillance video allegedly captured David Zapata, 32, walking toward LA high school student Xavier Chavarin, 17.
Los Angeles Police Department

Surveillance image of stabbing suspect
The suspect is seen brandishing a large knife seconds before the brutal attack.
Los Angeles Police Department

Police arrested Zapata early Wednesday at his Alhambra home, where he had barricaded himself, after they were tipped off that the person living there was the same man seen in the video, the LA Times reported.

LAPD officers surrounded Zapata’s home on Westmont Drive about 7 a.m. Wednesday using two armored vehicles, police Cmdr. German Hurtado said, the outlet said.

A crisis negotiator and a mental health team, with the help of Zapata’s mother, managed to persuade the suspect to surrender after he holed up inside alone, he said.

“I don’t want to taint the investigation, [but] he is not going to be able to hurt anyone else,” Hurtado said, adding that Zapata had a history of mental health issues and that Alhambra police said he’d “been a problem in this neighborhood.”

His bail was set at $2 million.

Zapata being taken into custody
Zapata is taken into custody after he barricaded himself in his home.

Xavier’s mom, Laura Frias, told KNBC-TV that her son had been waiting for her outside a restaurant when he was stabbed in the back multiple times.

The tragic teen’s family said he tried to get help but collapsed inside the King Torta eatery and died at the scene.

“It breaks my heart, the fact that they just took him away from me,” Frias told the news station. “I don’t know what to say. [I am] just so heartbroken. He was my love, my everything.”

Suspect seen with a skateboard in a surveillance image
The suspect was seen with a skateboard when he allegedly attacked another person.
Los Angeles Police Department

City Councilman Kevin de León, whose district includes the site of the attack, told the LA Times the city’s streets “are the largest psychiatric ward in the United States.”

“Unfortunately, it has become quite normalized in Los Angeles for someone to walk up to someone and snap and walks away freely, or just hits someone,” de León said.

“There’s no question about it — he’s suffered from severe mental illness,” he said of Zapata.

De León said the teen had a promising future and was a “great big brother” and a great son.

“He loved playing Legos. He loved playing with his Xbox. He loved fast cars, and he loved drawing,” he told the paper.

Schools Superintendent Alberto Carvalho visited a memorial for Xavier and said the stabbing was “an awful event.”

“When something goes wrong with a kid like that, the entire community should bow its head. We have to think about what’s happening in Los Angeles,” he said.

On Sunday, Woodrow Wilson High’s principal told students and parents in a message: “On behalf of our entire school community, I want to offer my deepest condolences to those who are impacted by this loss, including the student’s family, friends and teachers.”