The shooting of two men at the University of California, Los Angeles (UCLA) was a murder-suicide, according to the police.
Police officers swooped on the 400-acre campus on the west side of the city at 9.55am local time on Wednesday.
The incident was centred on Boelter Hall, a science building, where students had barricaded themselves in rooms during the shootings on the advice of police.
Following the discovery of two bodies a gun was found along with what might be a suicide note. No identifications have been released.
Agents from the FBI and the Bureau of Alcohol, Tobacco, Firearms and Explosives were among those at the scene.
At one point, a team in tactical gear stormed into a building and later people were seen emerging from buildings with their hands raised or behind their heads.
Police told people to stay away from the campus which is in a bustling part of the city before concluding that there was no further danger.
The shooting occurred the week before final exams at the school, the flagship 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 or to warn others of the incident.
Some described frantic evacuation scenes and a large police response, others wrote of sitting in darkened rooms after barricading doors.