The University of North Carolina at Charlotte lifted a campus lockdown on Wednesday morning, a day after a gunman killed two people and wounded four on the school’s last day of classes for the semester.

Police have named the suspect in the shooting as 22-year-old Trystan Andrew Terrell, a student at the school.

Charlotte-Mecklenburg police charged him with two counts of murder and four of attempted murder. Three of the four people he wounded were in a critical condition on Wednesday.

They offered no hints as to the suspect’s motive and did not identify the victims.

Students on the campus spent a harrowing night as police searched door-to-door for any other suspects, not giving people the all-clear to move around till almost dawn.

“This is the saddest day in UNC Charlotte’s history,” the school’s chancellor, Phil Dubois, said in a letter to the community posted on the school’s website. “Families of the deceased victims are being notified and university staff are with those who are injured.”

A police spokeswoman, Sandy D’Elosua, said the individual who was arrested was believed to have acted alone.

Three of the injured remain in a critical condition, with a fourth person suffering less serious injuries.

The shooting started at about 5.40pm on Tuesday, police said, in a classroom.

Tristan Field, a student who witnessed the shooting, told CBS News as many as 50 students tried to escape through two doors.

“A chair fell in front of the door, so people were tripping over that, like, trying to climb over it,” he said. “Some people fell down. It was like water through a funnel but wasn’t fast enough.”

The gunman was disarmed by two or three campus police officers who entered the building after responding to an emergency call, the campus police chief, Jeff Baker, said.

A vigil was planned at the school for Wednesday, CBS news reported.

North Carolina’s governor, Roy Cooper, called the incident a tragic day for the university and the state just a few days before graduation. “But I know the people in this community, and they will be here for each other,” he said.

Charlotte’s mayor, Vi Lyles, said earlier on Twitter as the incident unfolded: “We are in shock to learn of an active shooter situation on the campus of UNC Charlotte. My thoughts are with the families of those who lost their lives, those injured, the entire UNCC community and the courageous first responders who sprang into action to help others.”

Three of the wounded victims sustained critical injuries.

“Run, Hide, Fight. Secure yourself immediately,” the university said on Twitter shortly before 6pm.

The school said on its website on Tuesday that the campus was on lockdown and that students and staff should “remain in a safe location”.

Students and faculty wait near the entrance of the University of North Carolina Charlotte campus on 30 April 2019. Photograph: Logan Cyrus/AFP/Getty Images

Video footage posted to social media showed students evacuating campus buildings with their hands raised as police officers ran past them toward the scene of the shooting.

Susan Harden, a professor of education on campus since 2011 who also serves on the Mecklenburg county board of commissioners, expressed disbelief at the gun violence.

“This is a day at the end of the semester, when students are doing performances, presentations … this is just the worst thing,” said Harden said at the police staging area. “Our campus is so safe. So safe. I’ve never felt unsafe on our campus. I’m heartbroken.”

The university has more than 26,500 students and 3,000 faculty and staff. The campus was to host a concert at the school’s football stadium on Tuesday evening.