Two children, 6 and 7, were reportedly shot and transported to a hospital with minor wounds to their arms.
The alleged gunman tried to flee the scene but was chased and tackled by three nearby construction workers. One of the workers hit the suspect, Brendan L.O'Rourke, with his truck to stop him and the three held him until police arrived.
"He is possibly a transient who lives in the area," said Carlsbad Police Lt. Kelly Cain said. "He is not cooperating with the investigation. He probably has some mental health issues."
O'Rourke, 41, was arrested on suspicion of six counts of attemped murder and numerous weapons violations, Cain said. He is believed to have acted alone.
The campus was placed on lockdown while police gathered evidence. Parents of students were asked to meet at Laguna Rivera Park, which is a short distance from the school.
Police said O'Rourke is not cooperating with the investigation and they believe he has some mental health issues.
The Associated Press contributed to this report.