LAS VEGAS -- The man suspected of fatally shooting three people and wounding another at a Las Vegas university Wednesday was a professor who unsuccessfully sought a job at the school, a law enforcement official with direct knowledge of the investigation told The Associated Press.

The gunman was killed in a shootout with law enforcement, police said. The attack at the University of Nevada, Las Vegas sent shock waves through a city still scarred by the deaths of 60 people in a 2017 mass shooting.

The suspect previously worked at East Carolina University in North Carolina, according to the official, who spoke on the condition of anonymity because they weren't authorized to release the information publicly.

Police didn't immediately identify the gunman, the victims or a possible motive.

Reports of shots fired at about 11:45 a.m. sent police swarming onto the campus while students and professors barricaded themselves inside classrooms and dorm rooms.

Police said the shooting started on the fourth floor of the building that houses UNLV's Lee Business School. The gunman went to several floors before he was killed in a shootout with two university detectives outside the building, said UNLV Police Chief Adam Garcia.

Authorities gave the all-clear about 40 minutes after the first report of an active shooter.

Professor Kevaney Martin took cover under a desk in her classroom, where another faculty member and three students took shelter with her.

"It was terrifying. I can't even begin to explain," Martin said. "I was trying to hold it together for my students, and trying not to cry, but the emotions are something I never want to experience again."

Martin said she was texting friends and loved ones, hoping to receive word a suspect had been detained. When another professor came to the room and told everyone to evacuate, they joined dozens of others rushing out of the building. Martin had her students pile into her car and drove them off campus.

"Once we got away from UNLV, we parked and sat in silence," she said. "Nobody said a word. We were in utter shock."

Las Vegas shooting

Students and the community were alerted to the emergency by a university post on X that warned: "This is not a test. RUN-HIDE-FIGHT."

Matthew Felsenfeld said he and about 12 classmates barricaded their door in a building near the student union.

"It's the moment you call your parents and tell them you love them," said Felsenfeld, a 21-year-old journalism student.

Another student, Jordan Eckermann, 25, said he was in his business law class in a second-floor classroom when he heard a loud bang that he thought came from a neighboring music class.

But then a piercing alarm went off, sending students to their feet. Some ran from the room in panic while others heeded their professor's instructions to stay calm, said Eckermann.

He walked out and locked eyes with a law enforcement officer in a bulletproof vest holding a long gun. Clothing, backpacks and water bottles lay scattered on the floor.

Eckerman said he mouthed to the officer, "Where do I go?"

The officer pointed to an exit.

Minutes later, when he was outside, Eckermann said he heard bursts of gunshots, totaling at least 20 rounds. The air smelled of gun powder. He said he kept walking away from campus, even though he didn't know where to go.

UNLV's 332-acre (135-hectare) campus is less than 2 miles (3.2 kilometers) east of the Las Vegas Strip.

Vegas shooting

It wasn't immediately clear how many of the 30,000 students were on campus at the time, but Sheriff Kevin McMahill said students had been gathered outside the building to eat and play games. If police hadn't killed the attacker, "it could have been countless additional lives taken," he said.

"No student should have to fear pursuing their dreams on a college campus," the sheriff said.

The shooting occurred just miles from the location of the deadliest mass shooting in modern U.S. history. In the Oct. 1, 2017, massacre, a gunman opened fire from a high-rise suite at the Mandalay Bay, killing 60 people attending a music festival below and wounding hundreds more.

In response to the campus shootings, the Federal Aviation Administration issued a ground stop of all flights coming into Harry Reid International Airport. The university is roughly 2 miles (3.2 kilometers) north of the airport.

Classes were canceled through Friday at the university, and UNLV's basketball game at the University of Dayton, Ohio, was canceled Wednesday night because of the shootings.

------

Associated Press reporters Terry Tang in Phoenix; W.G. Ramirez in Las Vegas, Russ Bynum in Savannah, Georgia, and Robert Jablon in Los Angeles contributed to this report.