A teacher was arrested Wednesday for bringing a gun to the town's middle school, police said.

The 46-year-old teacher, Jason Adams, has a valid pistol permit, but Connecticut state law prohibits possession of firearms on school grounds.

A telephone message seeking comment was left at Adams' home in Newtown.

Adams was detained by school security after he was seen with the gun and then arrested by Newtown police who were called to Newtown Middle School, according to Police Chief James Viadero. Adams was charged with possession of a weapon on school grounds and released.

On Dec. 14, 2012, a gunman shot and killed 20 students and six educators at nearby Sandy Hook Elementary School. The shooter fatally shot his mother inside their Newtown home before going on the rampage and then killing himself.

Adams has been placed on administrative leave pending an investigation, according to the Newtown public school system, which said in a statement that it has been working closely with local police.

"This matter is very serious and troubling, both the Newtown Public School system and the Newtown Police Department took immediate steps to address the matter," the school system said.

Newtown police said the department has contacted the state's weapons licensing and permit unit to make them aware of the arrest.