A former Newtown, Conn., teacher accused of carrying a loaded pistol in school is set to ask a state judge to allow him into a probation program.

Jason Adams was arrested at Newtown Middle School after police say he was seen with the pistol — a loaded .45-caliber pistol in a holster — and detained by school security. He resigned in July after being placed on administrative leave.

Adams is scheduled to appear in Danbury Superior Court on Tuesday for arguments on his application for accelerated rehabilitation, which would result in the charges being erased from his record.

Police say Adams had a valid pistol permit, but Connecticut state law prohibits firearms on school grounds.

The middle school is less than 2 miles from the site of the Sandy Hook Elementary School Massacre in which 20 students and six educators were killed in December 2012.