California gunman fired 30 rounds at elementary school, left when he couldn't get inside It appears the gunman left the school frustrated after he couldn't get in.

 -- The gunman who went on an apparently random shooting spree in rural Northern California allegedly left an elementary school after he failed to access classrooms there, authorities said.

Four people were killed and 10 more were wounded in a series of shootings Tuesday morning in Tehama County. The shootings took place in seven locations, including at the Rancho Tehama School, an elementary school in Corning, about 130 miles north of Sacramento, police said, but no children were killed.

Ten people were hospitalized, including at least two children, police said. One student was shot inside a classroom at the school, while the other injured child was shot while sitting in a truck when the shooter drove by, police said.

The shooter rammed a fence at the gate of the school before entering the grounds with a semi-automatic rifle, Tehama County Assistant Sheriff Phil Johnston said in a press conference Tuesday afternoon. The school's gate had been locked, the Corning Union Elementary School District said in a statement.

The suspect was wearing a vest with clips attached to it, similar to ones often worn by U.S. soldiers, and fired 30 or so rounds at a number of classrooms, Johnston said. The gunman shot out windows and through walls, and broken glass led to some injuries, the school district said. The student who sustained a gunshot wound is in stable condition.

It appears that the gunman became frustrated when he could not gain entry inside the classrooms, so he re-entered his vehicle and continued the shooting spree in the streets.

The incident could have been much worse had it not been for the quick thinking of staff at the elementary school, Johnston said. The school district commended the school's staff for their "courageous and professional response" to the "terrible incident."

"The school was able to go on lockdown very quickly and effectively, which prevented any further injury or violence," the school district said.

Police have obtained surveillance video from the school but have not yet made the footage available to the public, Johnston said.

The male suspect was killed by police, but his motive is unknown, according to authorities. He has been positively identified, but Johnston declined to release his name at this point in the investigation.

There was an ongoing dispute between the gunman and a woman who was killed in the shooting spree, Johnston said. Authorities also said they were aware of a neighborhood dispute the suspect was involved in.

Coy Ferreira told ABC Redding, California affiliate KRCR he was dropping his daughter off for kindergarten when he heard what sounded like a firecracker. A school employee ran out and yelled for the children to get inside, Ferreira said. That’s when he ran into a classroom and multiple shots came through the classroom windows, hitting a student, he said.

Police said the motive is unknown but added that the gunman appeared to directly target the Rancho Tehama School and shot into the school multiple times, according to police.

Authorities said the shooting started just before 8 a.m. with random shots fired into residences. The suspect then engaged a citizen who followed him before stealing the citizen's car and opening fire through the community, police said.

The gunman "arbitrarily" shot at residents in the rural area as he drove by, Johnston said.

Shortly after, the gunman engaged with a woman who was taking her two children to school and allegedly opened fire on them at an intersection, authorities said. The mother suffered severe and life-threatening injuries from the shooting, and one of her children sustained non-life-threatening injuries, police said.

The gunman then turned his sights to the elementary school, where he spent about six minutes, Johnston said. After he left the school, he went back on the road and shot and killed one person, Johnston said.

After that, the suspect allegedly crashed the stolen car, robbed someone and took a second vehicle, authorities said.

The suspect, who was armed with a semi-automatic rifle and two handguns, engaged two officers and they returned fire, killing the suspect at the scene, according to police. Another weapon was found in the crashed vehicle, but it had not yet been recovered, Johnston said.

Authorities said they are aware of a domestic violence incident involving the suspect, adding that he had prior contact with law enforcement and apparently had a history of neighborhood disputes.

The suspect had been issued a restraining order in January, Johnston said, but the circumstances surrounding the order are unclear.

About 100 students attend Rancho Tehama School, which was placed on lockdown following the incident, according to Ann Bates, administrative assistant to the superintendent of the Corning Union Elementary School District.

All students have been accounted for, and the children have since been reunited with their families, officials said.

ABC News' Marilyn Heck contributed to this report.