A former middle school security guard was sentenced to jail Tuesday afternoon after admitting he sexually assaulted a minor, Middlesex County Prosecutor Andrew C. Carey announced.

Elios Arias-Aguilar, 26, was sentenced to seven years in state prison for the sexual assault. He pleaded guilty to one count of sexual assault in the second degree in January, officials said.

Arias-Aguilar, who was a security guard McGinnis Middle School in Perth Amboy, was accused of having sex with a minor at his home, authorities have said. Investigators also believe he sent nude photos to two minors he knew.

Authorities did not specify if the minors were students at the middle school, where he worked for two years. He’s since been terminated, officials said.

The Perth Amboy man will have to register as a sex offender under Megan’s Law and will be on parole supervision for the rest of his life, Superior Court Judge Michael A. Toto ruled. He was also ordered to have no contact with the victims.

Sophie Nieto-Munoz may be reached at snietomunoz@njadvancemedia.com. Follow her at @snietomunoz. Find NJ.com on Facebook.

Have a tip? Tell us. nj.com/tips

Get the latest updates right in your inbox. Subscribe to NJ.com’s newsletters.