Two people were killed and at least four wounded in a shooting Tuesday at the University of North Carolina's Charlotte campus.
The university's office of emergency management tweeted an alert warning that shots had been reported on campus shortly before 6 pm on what was students' last day of classes this academic year.
"Run, Hide, Fight. Secure yourself immediately," it said.
Local emergency services said two people had been killed, while another two sustained life-threatening injuries and two more were being treated for less serious wounds.
Police confirmed the shooter, identified by NBC Charlotte as a 22-year-old history student at the campus, was in custody.
A local Fox television affiliate meanwhile identified the dead as boys aged 17 and 18.
"Scene secure. One in custody. No reason to believe anyone else involved," the Charlotte-Mecklenburg Police Department tweeted, adding that law enforcement and university staff were sweeping buildings to round up those still sheltering.
Video footage posted on social media showed anxious students filing away from the school with their hands raised.
It was not immediately clear which part of the school the shooter targeted.
"It was a really scary experience to hear the shots and have to run... I didn't think
I would have to experience something like that," one student told NBC News.
Charlotte Mayor Vi Lyles said she was "in shock" after hearing of the rampage.
"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," she wrote on Twitter.
The shooting comes just days after a teenage gunman opened fire on a synagogue in Poway, California, killing one person and injuring three others: the latest in a string of mass shootings across the US.
According to government figures, 40,000 people were killed by firearms in the United States in 2017 -- two thirds of them suicides -- the highest annual toll in five decades.
The perennial debate over gun control in America kicks up again at each shooting, a far too frequent occurrence.
Yet no solution has been found over the decades that satisfies both those seeking stricter gun controls to reduce such tragedies and those supportive of constitutional guarantees to the right to bear arms.
Efforts have always proved divisive, and Republican lawmakers have been highly successful at preventing what they describe as an assault on their right to bear arms under the Second Amendment of the US Constitution.
The number of firearms in circulation has continued to grow (now at 393 million in a nation of 326 million people), and mass shootings have become a disturbingly regular part of American life.
The worst school shootings to date were those at Sandy Hook Elementary School in Newton, Connecticut in 2012 (20 young children and six adults were killed) and at Marjorie Stoneman Douglas High School in Parkland, Florida last year (17 dead).
But the power of an influential gun lobby and a long tradition of gun ownership have meant that little has been done to improve gun safety.