The two people killed and four who were injured when a college student with a pistol opened fire at the University of North Carolina-Charlotte on Tuesday were all students, according to the university's chancellor.

UNCC Chancellor Phillip Dubois told WBT Radio the two students who were killed were 19-year-old Ellis Parlier, of Midland, and 21-year-old Riley Howell, of Waynesville.

The four injured students were identified as Drew Pescaro, 19, of Apex, N.C., Sean Dehart, 20, of Apex, N.C., Rami Alramadhan, 20, of Saudi Arabia, and Emily Houpt, 23, of Charlotte, Dubois told WBT.

Three of the four injured students were undergoing surgery at a hospital, while one has been released.

UNC CHARLOTTE: SUSPECT FACING MULTIPLE CHARGES IN DEADLY CAMPUS SHOOTING, FAMILY SAYS HE IS STUDENT

The Lambda Delta Chapter of Alpha Tau Omega fraternity at UNCC said on Facebook one of their fraternity brothers, Drew Pescaro, was injured in the shooting. He was taken to the hospital and was listed in stable condition.

Officials said the suspect in the deadly shooting, 22-year-old Trystan Andrew Terrell, was charged early Wednesday of two counts of murder, four counts of attempted murder, four counts of assault with a deadly weapon with intent to kill, possession of a firearm on educational property and discharging a firearm.

Video from WBTV-TV showed Terrell being led into a police station, turning back while smirking at reporters.

"I just went into a classroom and shot the guys," Terrell told reporters Tuesday as officers led him away in handcuffs.

The suspect's grandfather, Paul Rold of Arlington, Texas, told the Associated Press that Terrell and his father moved to Charlotte from the Dallas area about two years ago after his mother died.

Terrell never showed any interest in guns or other weapons, and the news he may have been involved in a mass shooting was stunning, according to Rold who had not heard about the Charlotte attack before being contacted a reporter from the AP.

"You're describing someone foreign to me," Rold said Tuesday night. "This is not in his DNA."

PENNSYLVANIA WOMEN LEFT FRIEND TO DIE IN DRIVEWAY AFTER HEROIN OVERDOSE, POLICE SAY

The shooting happened around 5:40 p.m. at a classroom building on the school's main campus. Witnesses told FOX 46 that the campus erupted into chaos as students ran frantically to get to safety.

Officers assembling nearby for a concert rushed to the classroom building and arrested the gunman in the room where the shooting took place, according to Campus Police Chief Jeff Baker.

"Our officers' actions definitely saved lives," Baker said at a news conference.

During the shooting, Howell tried to jump on the gunman when he was shot and killed, WSOC-TV reported.

CLICK HERE FOR THE FOX NEWS APP

The university has more than 26,500 students and 3,000 faculty and staff. The campus is northeast of the city center and is surrounded by residential areas.

A vigil was planned for 6 p.m. Wednesday at the UNCC Star Quad on the campus, according to FOX46.

Fox News' Danielle Wallace, Nicole Darrah and The Associated Press contributed to this report.