Two people were killed and four others injured after a gunman opened fire in a classroom on a North Carolina college campus Tuesday afternoon.

The suspected shooter, identified by police as 22-year-old Trystan Andrew Terrell, was taken into custody after opening fire at the University of North Carolina at Charlotte, authorities said.

Terrell allegedly targeted a classroom on the campus at about 5 p.m., killing the two people and wounding four others — including three who were critically injured, authorities said.

Local media outlets reported he was a former student at the college who dropped out this year before completing his degree in history.

His grandfather told the Associated Press by phone on Tuesday night that he was shocked his grandson could be responsible for the slayings.

“This is not in his DNA,” said Paul Rold of Arlington, Texas.

He added that his grandson had moved to Charlotte about two years ago with his father.

Video taken by a local NBC affiliate shows Terrell being led from a police car into a police station after the shooting. The suspected shooter leaned back and smiled at cameras as he was being led into the station, the video shows.

The campus was locked down after the shooting and dozens of emergency vehicles and police cars responded to the building.

“Shots reported near kennedy. Run, Hide, Fight. Secure yourself immediately,” the university said in an emergency tweet after the shooting, referring to a building on the campus.

A concert on campus featuring the rapper Waka Flocka was canceled because of the shooting, police officials said in a press conference Tuesday night.

“I’m safe y’all,” Waka Flocka wrote in a tweet after the attack.

With Post wires