CHARLOTTE, N.C. (Reuters) - A gunman reported to have been a student opened fire in a building at the University of North Carolina’s Charlotte campus on Tuesday, killing two people and wounding four others, three of them critically, officials said.

Details of the early evening violence remained hazy hours later, but campus Police Chief Jeff Baker said his emergency dispatch office first received a call about an individual armed with a pistol who had shot several students.

Two or three campus police officers responding to the call entered the building, disarmed the gunman and took him into custody, Baker said.

The accused shooter was identified late Tuesday as Trystan Andrew Terrell, 22, who is in custody with charges pending. No other information about Terrell was released.

Officials offered no explanation for what might have precipitated the shooting, and it was unclear whether the assailant knew any of his victims.

Local television news footage showed police officers escorting a tall, lanky young man with shaggy brown hair from a patrol car. As he was taken into a station house, the man looked over his shoulder with a smile and appeared to yell something at reporters.

Several local media outlets reported the gunman either was or had been a student on the campus.

“Our officers’ actions definitely saved lives. There’s no doubt about that,” Baker said.

The gun violence, coinciding with the last day of classes for the academic year, prompted a security lockdown of the entire campus as police swept the university one building at a time, evacuating students as they progressed.

Trystan Andrew Terrell in a booking photo released by the Mecklenburg County Sheriff's Office. REUTERS/MCSO/Handout

Video aired on local television and posted to social media showed scenes that have become all too familiar in the United States due to the rise in school gun violence, with students evacuating campus buildings with their hands raised as police officers ran past them toward the scene of the shooting.

About three hours after the shooting, Baker said all university buildings had been searched and secured and that students who live on campus could return to their dormitory halls. The university said final exams would be postponed through Sunday.

An outdoor concert scheduled for Tuesday night at the campus football stadium by rap artist Waka Flocka Flame was also canceled after the shooting.

LONE SUSPECT

Sandy D’Elousa, a spokeswoman for the Charlotte-Mecklenburg Police Department, which is leading the investigation, said the suspect in custody was believed to have acted alone.

The Federal Bureau of Investigation said its agents were on the scene assisting police.

“The FBI is prepared to provide any resource needed as the investigation continues to determine exactly what led to this tragic loss of life in our community,” said John Strong, special agent in charge of the FBI field office in Charlotte.

Baker confirmed that two victims were killed and four other injured, three of them listed in critical condition.

Television station WBTV in Charlotte, the state’s most populous city, reported that gunfire erupted near the university’s Kennedy Hall administrative building.

“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,” Charlotte Mayor Vi Lyles said on Twitter.

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,” 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.”

Initial word of the shooting surfaced in a frantic warning posted by the school on its official Twitter account.

“Run, Hide, Fight. Secure yourself immediately,” the university posted. The school said later on its website the campus was on lockdown and that students and staff should “remain in a safe location.”

According to its website, the University of North Carolina at Charlotte enrolls more than 26,500 students and employs 3,000 faculty and staff.

The deadliest mass shooting on a campus of higher education in the United States took place at Virginia Tech University in Blacksburg, Virginia, on April 16, 2007, when a student killed 32 people in a shooting rampage, before killing himself.