A longtime Montgomery County teacher and coach accused of having sex with a 16-year-old student in a case that prosecutors eventually dropped resigned Wednesday rather than continue fighting to retain his job.

Scott Duane Spear, of Rockville was arrested and charged with two counts of committing a fourth-degree sex offense. (Courtesy of Montgomery County Police Department/COURTESY OF MONTGOMERY COUNTY POLICE DEPARTMENT)

In February, Spear was arrested by Montgomery County Police for a fourth degree sex offense over allegations he twice had sex off campus with a student who was on the track team at Richard Montgomery High School in Rockville, where Spear was a part-time coach. Spear also was a full time teacher at nearby Julius West Middle School, which the girl had previously attended.

In an interview with police, Spear denied having intercourse with the girl, a police affidavit states. The affidavit said Spear told police he and the student “were very close and did communicate frequently” during school hours and after school and on weekends.

At the age of 16, the girl had reached Maryland’s age for consensual sex and as her part-time coach, Spear felloutside the Maryland law that prohibits sexual contact between “full-time permanent” school employees and students at the school at which they work, prosecutors said when they dropped the case.

Spear of Rockville started with Montgomery County Public Schools in 1993, said schools spokesman Dana Tofig. Spear’s statement said he had been with the school system since 1988.

He had asked to return to his job after the case was dropped.

In his announcing his decision to resign, Spear said “the allegations were false and this was a rush to judgment.” He said it was time “to put this all behind me and move on to the next phase of my life.”