SAN BERNARDINO, Calif. — Gunfire erupted inside an elementary school classroom in San Bernardino, Calif., on Monday, leaving two adults and one student dead in what the authorities said was an apparent murder-suicide.

The shooter, whom the police identified as Cedric Anderson, 53, walked into the classroom and without speaking opened fire on his wife, Karen Elaine Smith. Ms. Smith, 53, was the lead teacher in the class of 15 students with special needs, who ranged from first to fourth graders.

Two students were standing behind Ms. Smith, though the police did not say whether they had been directly hit by gunfire or wounded with shrapnel. An 8-year-old student, Jonathan Martinez, was airlifted by helicopter from the school, North Park Elementary, to a nearby hospital where he was pronounced dead shortly after he arrived. A 9-year-old student was also wounded and was in stable condition Monday afternoon.

The shooter entered the school through the front office and was checked for his identification, following routine procedures, the police said. There was no sign Mr. Anderson was carrying a weapon.