One of the suspects wrote messages of hate speech on the gun used during the shooting, CNN reported.
Anti-Islamic writings were also found in a vehicle connected to the suspects, a US Justice Department official told Reuters.
The firearm was taken from their parents’ home, where police found a suicide note that contained writing about racial pride, according to law enforcement officials.
Scott Wahl, the San Diego police chief, said there was no specific threat to the Islamic Centre included in the messages.
He said: “It was just general hate kind of speech that I think covered a wide gamut”.
Clark attended the local Madison High School, where he was a talented wrestler. His grandfather, David Clark, 78, said: “We’re very sorry for what happened. We know as much as you do. It’s a shock.”
Family and friends identified the security guard credited with saving lives as Amin Abdullah.
Wahl praised the security guard’s actions as “heroic” and added: “Undoubtedly, he saved lives today”.
Yesterday, the mother of one of the suspected assailants called the police to report him as a “runaway juvenile”.
She warned the force that her son was suicidal, multiple guns were missing from her home, and that he was with a companion dressed in camouflage.
Officers received reports of an active shooter at the religious centre, which is the largest in the county and were on the scene within four minutes.
While the gunmen never entered the complex, children inside said they heard up to 16 shots and were ushered into a closet.
Upon their arrival, police “observed immediately what appeared to be three deceased victims out in front” of the building, Wahl said.
Between 50 and 100 officers entered the complex and secured the building.
The force also received calls of active gunfire “from a couple of blocks away”.
Officers later found that a landscaper had been shot at while he was working at a residence on Salerno Street, about an eight-minute walk from the mosque, but “fortunately, he was not hit”.
After arriving at the scene, police found the two suspects dead inside a vehicle in the middle of the street.
Wahl told reporters: “There were no officers involved in firing their weapons”.
The Islamic Centre of San Diego said its members were “heartbroken by the tragic shooting” and thankful to the emergency services and staff members who “helped protect lives during an unimaginable situation”.
Sign up to Herald Premium Editor’s Picks, delivered straight to your inbox every Friday. Editor-in-Chief Murray Kirkness picks the week’s best features, interviews and investigations. Sign up for Herald Premium here.