(CNN) A man armed with a pistol opened fire on the final day of classes at the University of North Carolina at Charlotte, killing two people and leaving four others wounded -- three of them critically, authorities said.

The former student, whom authorities identified as Trystan Terrell, 22, apparently targeted the Kennedy building, police said.

"We know there was some familiarity with that building in particular," Charlotte-Mecklenburg Police Chief Kerr Putney told reporters Wednesday, declining to elaborate. "The choice of that building was by design. It was intentional."

Just before 6 p.m. Tuesday, gunshots erupted as students waited for rapper Waka Flocka Flame's concert and others prepared for exams later in the week.

"Run, Hide, Fight," the university tweeted after it received calls on the shooting at the Kennedy building. "Secure yourself immediately!"

Sophomore Joshua Ayers, 20, was in the classroom when the shooter entered. The liberal studies class has about 100 students, but only about 30 were on hand Tuesday for final presentations, one of which was underway when the shooting began, he said.

Suspect Trystan Terrell, 22, faces multiple charges, including two counts of murder.

"All of a sudden, the door on the north side of the room slams open. A guy rushes in, pulls up a gun with his right hand ... and began firing at the far north corner table," Ayers said. "He didn't speak a word -- just ran in and started shooting.

"Almost immediately, people start diving away. ... People started rushing for the door," he said.

Riley Howell was killed but not before he charged the gunman, his aunt, Morgan Howell Moylan, told CNN on Wednesday, recounting the police account to the family. He was shot point-blank trying to thwart the attack, she said.

"He did such a heroic thing," Moylan said. "It was absolutely no surprise. In fact, I have four children who so look up to him. Every one of them said, 'Of course, he was the hero -- 100% of course he'd run toward the shooter.' He was everybody's protector. You felt safe when you were with Riley."

Terrell was taken into custody without incident. As police led him away in handcuffs, he tilted his head back and smiled at the cameras.

Terrell is facing two counts of murder, four counts of attempted murder, four counts of assault with a deadly weapon with intent to kill and one count each of possession of a firearm on educational property and discharging a firearm on educational property, the Charlotte-Mecklenburg Police Department said.

He is being held without bail and is scheduled to make his first court appearance at 1 p.m. Thursday.

"We, all of us, everyone in this community, stands in shock and grief," Charlotte Mayor Vi Alexander Lyles told reporters.

'Randomness' of shooting concerns authorities, police chief says

JUST WATCHED UNCC police chief: We're all devastated Replay More Videos ... MUST WATCH UNCC police chief: We're all devastated 00:57

Authorities have not yet identified a motive for the shooting.

"Unfortunately, this is an incident that really strikes a chord with us all. We can't really discern the why just yet," Putney said. "It really appears that there was no specific person."

"And the randomness is what's more concerning," he added.

Terrell legally purchased the handgun he used in the shooting, Putney said. He had "quite a bit" of ammunition with him, the police chief said.

Putney declined to say specifically whether Terrell referenced any other school shooting.

"Unfortunately, there are people who want to replicate stuff like that," Putney said.

Campus was on lockdown for hours

Reed Parlier

The university said Howell of Waynesville, North Carolina, and Reed Parlier, 19, of Midland, North Carolina, were killed. University officials identified the injured victims as Rami Al-Ramadhan, 20, of Saihat, Saudi Arabia; Sean DeHart, 20, of Apex, North Carolina; Emily Houpt, 23, of Charlotte; and Drew Pescaro, 19, of Apex.

The campus newspaper reported that Pescaro is one of its sportswriters. Moylan said Howell is the oldest of four siblings, and he transferred to UNC Charlotte from an Asheville technical school. He enjoyed working out, the outdoors, cooking and driving the boat during trips to the lake house. He was a "big teddy bear" who wanted to join the military, his aunt said.

"For his side hustle, he worked for a landscaping company. He'd always deliver the biggest trees because he was able to pick them up. The old ladies loved him," Moylan said.

The school of about 30,000 students remained on lockdown for hours as a familiar scene replayed at the latest shooting in the United States.

While authorities worked to clear buildings, panicked students crouched in halls as helicopters buzzed overhead. Officers escorted students out of buildings with their hands up.

University officials sent an alert asking students to follow instructions from officers and warning others to stay away from campus until they received an all-clear.

"If you have not contacted your family, please do so," the campus tweeted.

UNC Charlotte Chancellor Philip Dubois receives a hug after a news conference on the deadly shooting.

By midmorning Wednesday, the university was quiet. Reporters outnumbered students and faculty making their ways across campus. Workers were fixing a door at the library where several students sought cover during the shooting.

Local and state police guarded the Kennedy building, which houses administrative offices and some classrooms, in what is typically a busy part of campus.

University Chancellor Philip Dubois said the campus will return to normal operating status at midnight and employees will return to work Thursday morning.

Exams, set to begin Thursday, were canceled through the end of the week.

He started shooting during presentations

Family members and friends wait for their loved ones after the shooting.

Tristan Field said the gunfire started while he was in class.

"He just started shooting during our final presentations and we all ran out," Field tweeted. "We were just doing presentations and someone started shooting up the room. ... Why here? Why today? Why UNC Charlotte? Why my classroom? What did we do?"

Monifa Drayton, an assistant vice president at Atrium Health, told CNN affiliate WBTV that she was walking into the building to teach a class when gunfire rang out. Terrified students dashed outside the building. She helped lead them to a nearby parking deck.

"The children were absolutely petrified," Drayton said. "And I also sat and waited with a gentleman whose girlfriend ... was in the library. And at that point the library doors had been shot out and she was in there barricaded."

The shooting happened days after a gunman opened fire at a synagogue near San Diego, killing a woman and wounding three others.

"I can't tell you the sadness of the entire community to know that a situation like this has occurred on our campus," UNC Charlotte police Chief Jeff Baker said. "We are all pretty much devastated."

Dubois called it "the saddest day" in UNC Charlotte's history.

Officers were nearby when gunfire started

A student sits under a tree after the shooting on the Charlotte campus.

When the initial reports of a shooting came in at 5:42 p.m., officers were nearby, getting their assignments and a briefing for the Waka Flocka Flame concert. The rapper later said he was safe and nowhere near campus.

An officer quickly went to the room from where the suspect opened fire, disarmed him and took him into custody, Baker said. At the time of his arrest, the suspect was armed with a pistol, he said.

The suspect did not say a word while he was being handcuffed.

"Right now, he is not somebody (who) was on our radar," Baker said.

Giffords: 'You deserve better'

Frustrated officials decried yet another shooting at a campus in the United States.

"A student should not have to fear for his or her life when they are on our campuses," Gov. Roy Cooper told reporters. "Parents should not have to worry about their students when they send them off to school. And I know that this violence has to stop."

The governor ordered all flags in the state lowered to half-staff through sunset Friday.

Former US Rep. Gabby Giffords, who survived gun violence, sent condolences to the victims' families.

I am so sorry for these young people and their families. We fail as a nation when we fail to protect our children. You deserve better. #UNCC https://t.co/GbOLb3oo8A — Gabrielle Giffords (@GabbyGiffords) May 1, 2019

"I am so sorry for these young people and their families. We fail as a nation when we fail to protect our children. You deserve better," she said on Twitter.

Suspect's neighbor speaks

Students and faculty convene near an entrance to campus after the shooting.

At the apartment complex where the suspect lived, residents watched as police entered a unit believed to be his and stayed for hours.