Two teenagers armed with multiple firearms attacked the Islamic Center of San Diego on Monday, killing three men before taking their own lives in an assault that investigators are treating as a hate crime driven by white-supremacist ideology. The FBI said Tuesday it had recovered more than 30 firearms and ammunition from searches of homes associated with the suspects.

A mosque leader said the death toll could have been far higher if not for the actions of one of the victims — a security guard who fired back at the attackers and used his radio to alert others, triggering a lockdown that kept the teenage gunmen away from approximately 140 children who were in a classroom only steps away.

San Diego police Lt. Scott Wahl told reporters that the suspects, whose names have not been publicly released by authorities, tried to storm the building. The security guard’s response gave community members the critical seconds needed to secure the children and others inside, officials said.

FBI investigators said the two teenagers met online and left writings expressing hatred toward multiple religions and racial groups. The agency’s examination of those writings is ongoing. The FBI said it had recovered more than 30 firearms and ammunition from searches of the suspects’ homes, though authorities have not detailed how the teenagers obtained the weapons.

The three victims were identified as Nadir Awad, Lee Clark, and Amin Abdullah. Clark was the security guard who returned fire and initiated the lockdown, according to community members and mosque leadership.

United Nations Secretary-General Antonio Guterres said in a statement delivered by spokesman Stephane Dujarric that he was “deeply saddened” by the attack and extended condolences to the victims’ families and the Muslim community.

Muslim leaders in San Diego and nationally called for increased security at mosques and Islamic centers, saying the attack was the latest in a pattern of violence targeting the community. Community members gathered at a Monday night vigil to mourn the three men who died.