The student who stabbed four people on the campus of UC Merced was identified Thursday as 18-year-old Faisal Mohammad from Santa Clara, Calif., the university confirms to Fox News.
"He had a smile on his face, he was having fun," a construction worker who helped stop the attack told CBS 47.
Campus police shot and killed Mohammad, a freshman computer science & engineering major, after Wednesday's attack. Police detonated his backpack and are testing a substance inside, KGO reports.
The four victims are expected to survive.
Authorities are investigating a motive. They say Mohammad was armed with a hunting knife, and that its blade was 8 to 10 inches long.
The construction worker ran into the classroom to stop the attack, saying he'd initially thought it was a fight. Byron Price, 31, was working on remodeling a waiting room when he heard a commotion and rushed to check on it.
Price told CBS 47, "It was a really big knife and he was swinging it down so I figured if I was on the ground and my feet were at him, he could get my legs and not my body."
"I really believe he's a hero here. I think he prevented this first student from dying," Merced County Sheriff Vern Warnke said. "The cops on campus, oh my gosh, praise them because they stopped a threat, but this first guy, he stopped a death."
Two of the injured had to be airlifted to nearby hospitals, and the other two were treated on campus. The incident began when the assailant used the knife to stab two people in a second-floor room around the start of an 8 a.m. class.
Warnke said the suspect fled the room after attacking the construction worker and ran down two flights of stairs to the outside where he stabbed a school employee sitting on a bench. The suspect fled the building. He was shot and killed by pursuing campus police on a nearby foot bridge.
All the victims were conscious when paramedics reached them, Assistant Vice Chancellor Patti Waid said.
Lensy Maravilla, 19, a first-year student, said she was in a biology class on the second floor of the same building, when a female student ran in.
Maravilla said the student "was crying hysterically and came in and said that she had seen somebody get stabbed, or slashed, in the throat and she ran."
The main road to enter the campus remained closed to outside traffic Wednesday night and classes were canceled until Friday at the university, which is about 120 miles south of Sacramento in the farm-rich San Joaquin Valley. Police were allowing students who live on campus to come and go, but anxious parents waited in their vehicles at the end of the dark roadway about a half mile from the campus entrance.
Among them were Larry and Yen Little, who drove about 110 miles from their home in Elk Grove to pick up their daughter Dana. Larry Little said he knows incidents of campus violence are rampant.
"I knew someday it might, but I was just hoping it wouldn't happen here. It's a small campus out in the country," said Little. "Thank god the guy didn't have a gun, shooting people, killing them."
Stabbings involving multiple victims on college campuses have not raised as much alarm as mass shootings since the attacks do not usually result in as many deaths or injuries. Several U.S. colleges have been the site of violent attacks involving bladed weapons.
A student at Morgan State University in Maryland was charged in March with slashing two other students with a pocket knife outside a campus dining hall. In 2013, a 20-year-old student at a Texas community college wounded at least 14 people during a building-to-building attack.
The campus with about 6,000 students in the city of Merced opened a decade ago and is the newest one in the University of California system.
It was erected in the state's farm belt in response to the burgeoning enrollment in the nine other University of California campuses. Regents also felt the mainly agricultural region was unrepresented by higher education.
Applications to University of California campuses are due at the end of November. Chancellor Dorothy Leland sought to reassure families that their children would be safe if they ended up at UC Merced, which she said "may still be small in its study body but is large in its sense of community."
"This was a tragic accident, a tragic event, OK? But the person who caused this event will no longer be able to cause an event in the future. Their children are safe here," Leland said.
Fox News' Mike Lundin and The Associated Press contributed to this report.