SAN FRANCISCO (AP) — An 18-year-old California university freshman went on an elaborately planned rampage with a hunting knife because he was barred from a study group, authorities said.

Merced County Sheriff Vern Warnke said a two-page “manifesto” detailing Faisal Mohammad’s motive and plans to terrorize and kill several classmates at the University of California, Merced was found on his body Thursday during his autopsy.

Campus police shot and killed Mohammad after the teen stabbed two students, a university employee and a construction contractor shortly after 8 a.m. PST Wednesday on the rural campus in the farm-rich San Joaquin Valley, 120 miles south of Sacramento. The four are expected to survive.

Mohammad’s plan for revenge discussed his anger with being kicked out of the study group, the sheriff said, but he didn’t know why the computer science and engineering major was excluded from the group.

Warnke said Mohammad planned to use plastic ties to bind the hands of his classmates to their desks in his Wednesday morning class. He was then going call police with a fake distress call and ambush responding officers with a hunting knife and steal their guns. He planned to use the guns to shoot a list of students he named in his “manifesto,” including those in his study group.

“He had delusions of grandeur,” the sheriff said. “I don’t think he had any actual capability to carry it out.”

Warnke said Mohammad’s plan was written in English and referenced the Muslim god Allah several times. But Warnke said the student was motivated by personal animosities and the attacks had nothing to do with religion or terrorism.

“We had a teenager who was upset he was kicked out of a study group,” Warnke said. “We had a teenager who didn’t know how to channel his anger.”

The sheriff said Mohammad was born in the United States. He said investigators didn’t find any evidence of mental illness.

Mohammad began his rampage by attacking a fellow student with a knife in a required general education course Wednesday morning. Byron Price, 31, a construction worker doing remodeling next door, ran into the classroom and is credited with preventing Mohammad from killing his initial stabbing victim.

Price said he thought he was breaking up a fistfight when Mohammad charged at him with the knife, stabbing him in the side.

“His eyes, I could see fear in his eyes,” Price told the Merced Sun Star. He was smiling.”

Mohammad fled the room and stabbed two others— one in a stairway, the other on bench outside— before police shot him on a nearby pedestrian bridge.

Police found zip-tie handcuffs, duct tape and a hammer in a backpack near his body. It also contained two plastic baggies of petroleum jelly, which Warnke called a “poor’s man” explosive if ignited.

Officials said background checks with the help of the FBI and Homeland Security showed the 18-year-old had no connections to organized hate or terror groups and no past behavior to suggest he would lash out violently.

“We had zero to indicate he was on anyone’s radar,” Warnke said.

Investigators also found a list of items Mohammad planned to pack in his backpack before the attacks.

“His intention was to do more damage,” UC-Merced spokeswoman Lorena Anderson said. “But there is absolutely no reason to believe that this was anything more than an angry young man acting alone.”

A high school buddy in Santa Clara, California expressed shock that Mohammad stabbed four people.

“He was quiet, but he was really friendly,” Ish Patel said. “He was intelligent, too — he performed well academically.”

Patel said Mohammad enjoyed basketball, going to the mosque to pray and playing video games with his friends. He lost contact with Mohammad after they graduated from high school in June.

But Mohammad’s suitemate at college paints a portrait of an anti-social loner. Andrew Velasquez told KSFN-TV in Fresno that Mohammad kept to himself.

“(Mohammad) didn’t talk much. And I never saw him walk with anybody. Walking to class, I never saw him walk with anybody,” Velasquez said.

One student remained hospitalized Thursday, and a staff member who suffered a collapsed lung was recovering after surgery, the school said. Price and a second student were treated and released.

Classes the university’s 6,700 students were scheduled to resume Friday.

___

Elias reported from San Francisco. Associated Press writer Alina Hartounian in Phoenix contributed to this story.