A gunman who opened fire at Michigan State University killed three students and wounded five, setting off an hours-long manhunt as frightened students hid in classrooms and cars.
The gunman eventually killed himself, police announced.
Police at a news conference later on Tuesday identified the gunman as 43-year-old Anthony McRae.
They said he shot himself miles away from campus while being confronted by police.
Officials earlier said the gunman was not a student or employee and had no affiliation with the university.
The shooting began on Monday night at an academic building and later moved to the nearby student union, a popular gathering spot for students to eat or study.
As hundreds of officers scoured the East Lansing campus, about 90 miles northwest of Detroit, students hid where they could.
Four hours after the first shots were reported, police announced the man’s death.
“This truly has been a nightmare we’re living tonight,” said Chris Rozman, interim deputy chief of the campus police department.
Dominik Molotky said he was learning about Cuban history around 8:15 p.m. when he and the other students heard a gunshot outside the classroom.
He told ABC’s Good Morning America that a few seconds later, the gunman entered and fired three to four more rounds while the students took cover.
“I was ducking and covering, and the same with the rest of the students.
“He let off four more rounds and when it went silent for about 30 seconds to a minute, two of my classmates started breaking open a window, and that took about 30 seconds to happen.
“There was glass everywhere,” Mr Molotky said.
“After that, we broke out the window and I climbed out of there, and then I booked it back to my apartment,” he said.
He was unsure whether gunfire hit any of the students.
Ryan Kunkel (22) was attending a class in the Engineering Building when he became aware of the shooting from a university email.
Mr Kunkel and about 13 other students turned off the lights and acted like there “was a shooter right outside the door”, he said.
“Nothing came out of anyone’s mouth” for over four hours, he said.
“I wasn’t ready to accept that this is really going on next door,” Mr Kunkel said.
“This is supposed to be a place where I’m coming, learning and bettering myself.
“And instead, students are getting hurt.”
The shooting is the latest in what has become a deadly new year in the US.
Dozens of people have died in mass shootings so far in 2023, most notably in California, where 11 people were killed as they welcomed the Lunar New Year at a dance hall popular with older Asian Americans.
In 2022, there were more than 600 mass shootings in the US in which at least four people were killed or wounded, according to the Gun Violence Archive.
“This is a uniquely American problem,” Michigan governor Gretchen Whitmer lamented.
Mr Rozman, of the campus police, said two people were killed at Berkey Hall and another was killed at the MSU Union, while five people were in critical condition at Sparrow Hospital.
Police eventually confronted the gunman, who then died by a “self-inflicted gunshot wound”, Mr Rozman said.
“We have no idea why he came to campus to do this tonight. That is part of our ongoing investigation,” the deputy chief said.
Ted Zimbo said he was walking to his dorm when he encountered a woman with a “ton of blood on her.”
“She told me, ‘Someone came in our classroom and started shooting’,” Mr Zimbo said.
“Her hands were completely covered in blood. It was on her pants and her shoes.
“She said, ‘It’s my friend’s blood.’”
Mr Zimbo said the woman left to find a friend’s car while he returned to his SUV and threw a blanket over himself to hide for three hours.
Michigan State has about 50,000 students, including 19,000 who live on campus.
All classes, sports and other activities were cancelled for 48 hours.
Interim university President Teresa Woodruff said it would be a time “to think and grieve and come together.”
“This Spartan community — this family — will come back together,” Prof Woodruff said.