A Riverhead elementary schoolteacher charged last year in an 11-count indictment with drunken driving and criminal possession of a weapon pleaded guilty Wednesday to driving while intoxicated, but managed to avoid the gun charge on a technicality.

The Suffolk district attorney's office said they couldn't determine the legality of the police search that led to the discovery of a loaded .45-caliber pistol in Joseph N. Johnson's car, and Suffolk County Judge James Hudson agreed.

Johnson, 40, of Southampton, was arrested by Southampton Village police about 3:30 a.m. on April 21, 2012, and charged with drunken driving and criminal possession of a weapon, the district attorney's office said. After Johnson was arrested, police searched his car and found the loaded handgun in the glove compartment.

Johnson, a fourth-grade teacher at the Phillips Avenue Elementary School in the Riverhead Central School District and who coached Riverhead High School's junior varsity basketball team, will be sentenced Jan. 8.

Attempts to reach Johnson late Wednesday were unsuccessful.

At the time of his arrest, the school district said it was "monitoring the matter." It said Johnson was removed from the classroom and "administratively reassigned to his home, immediately after his arrest."

The school district's statement at the time said Johnson was fingerprinted and "cleared by New York State" before he was hired. His status after Wednesday's plea could not be determined late Wednesday night.

Latest videos

DON'T MISS THIS LIMITED-TIME OFFER1 5 months for only $1Save on Unlimited Digital Access