Two men have been killed at the University of California in Los Angeles (UCLA).
The shooting, that led to a massive response on the campus in a bustling part of LA, was a murder-suicide, authorities said.
Police chief Charlie Beck declared the campus safe about two hours after authorities received an emergency call.
The shooting happened in a small office in an engineering building called Boelter Hall, and a gun was found along with what might be a suicide note, he said. No names have been released.
Hundreds of officers from multiple federal and local agencies swarmed the campus, which had been placed on lockdown.
Teams in tactical gear looking for victims and suspects ran across campus, some with weapons drawn, and stormed into buildings.
People emerged from buildings with their hands raised or behind their heads.
The shooting occurred the week before final exams at UCLA, a major campus of the University of California system with about 43,000 students.
Many students posted to social media, many to let friends and family know they were safe.
Some described frantic evacuation scenes and a large police response. Others wrote that their doors were not locking and posted photos of items such as photocopiers pushed up against them.
The focus of police activity was a cluster of engineering buildings near the centre of a campus that occupies 419 acres in Los Angeles.
At a mathematical sciences building near Boelter Hall, Swat officers with guns drawn cleared occupants who emerged one by one.
One man walked out with his hands up and was told to get on his knees. An armed officer searched him and his backpack, then sent him on his way with his hands still in the air.
Bioengineering professor Denise Aberle said she could see "a lot of police activity with innumerable cars" and a police helicopter hovering over the engineering building.
"Police keep coming," she said.