SACRAMENTO (CBS13) – A former Natomas-area teacher has been sentenced to jail time and will have to register as a sex offender.

Scott MacMillan was a teacher at Heron School. Back in 2017, he was arrested after an investigation into accusations he was using his cellphone to try and take inappropriate pictures of students.

READ MORE: Stockton Heat Leaving Central Valley For Canada Starting Next Season

Detectives say students saw MacMillan use his phone to record a 12-year-old girl under her desk.

Police investigators later seized MacMillan’s phone and found images of what looked like girls’ private parts.

READ MORE: 1 Arrested After Spectators Allegedly Block Deputies Trying To Break Up Sutter County Sideshow

Back in Oct. 2017, MacMillan pleaded no contest to charges of attempted possession of child porn, attempted use of a concealed camera to take photos of an adult victim for sexual purposes, and use of a concealed camera to take photos of a minor for sexual purposes.

Monday, MacMillan was given a sentence of 30 days in county jail and 3 years of probation. He will also be required to register as a sex offender, according to the Sacramento County District Attorney’s Office.

MORE NEWS: Gov. Gavin Newsom Threatens Mandatory Water Cuts If Californians Don’t Use Less Water

In a statement, the Natomas Unified School District said MacMillan was put on leave during the initial investigation. MacMillan resigned once the district began termination proceedings, officials say.