SAN FRANCISCO -- A 17-year-old boy gunned down another student outside their school Tuesday, ditched his gun and slipped into a class without arousing suspicion, evading capture for almost two hours as he joined thousands of students locked down inside classrooms because of the shooting, police said.

The teen was arrested in a gym class by officers who used surveillance video to track him after he shot and wounded a 16-year-old boy, then handed his gun in a backpack to someone in a car.

"It's disturbing to see that he was able to go right around to his normal business," police Capt. John Cregan told The Associated Press. "It's a scary situation."

The two teens got into an argument before the gunman shot the victim twice. He fell but was able to get back up and run to a car that took him to the hospital, Cregan said. He was in stable condition.

Police don't know if the person who took the backpack and drove away knew a gun was inside. They're investigating whether the shooting was gang related.

More than 10,000 students and staffers in a complex with three schools were locked down after the shooting outside Ridgway High School in Santa Rosa, north of San Francisco.

The shooter was "behaving normally," following lockdown protocol by going to the nearest classroom after the shooting. The gym teacher and other students didn't realize he was the gunman, Cregan said.

Witnesses told police the shooter fired three to four rounds before fleeing, authorities said. Dozens of students were in the area at the time. The suspect was booked into juvenile lockup on suspicion of attempted murder. His name wasn't released because of his age.

Panicked parents got text messages and worried about their kids' safety. Cherie Posluszny said her 17-year-old daughter texted that someone got shot.

A minute later, the girl texted, "I love you," followed by another message before her phone stopped working. She then used a friend's phone, and her mother asked if she was OK.

"Not really. But I will be OK," her daughter responded. The girl said she spent hours lying on the cold floor hiding behind a teacher's desk with other students.

Posluszny said she worried how this "new normal" was affecting children.

"This is becoming routine. It's part of the culture now. These kids are also victims," she said as she raced to the school.

Police said the shooting was originally reported on the Ridgway High campus just before 9 a.m. but later said it happened on the sidewalk just outside the school, which does not have metal detectors.

It is part of a sprawling complex that also includes Santa Rosa High School, Santa Rosa Junior College, school district offices and athletic fields. The complex with thousands of students, teachers, administrators and others was locked down as a SWAT team searched for the gunman, Cregan said.

Santa Rosa police, who are getting help from the FBI, lifted the lockdown around 11:30 a.m. following a thorough sweep of the schools.

Ridgway High, about 55 miles (89 kilometres) north of San Francisco, is an alternative continuation school for Santa Rosa High.

------

Dazio reported from Los Angeles. Associated Press writer Jocelyn Gecker contributed from San Francisco.