A Secret Service officer assigned to the White House was sentenced to 20 years in prison Thursday for sexting with minors and sending several underage girls sexually explicit images.

Lee Robert Moore, of Church Hill, Maryland, must also register as a sex offender and will be on supervised release for the remainder of his life, the Justice Department announced.

Moore, 38, pleaded guilty to enticing a minor to engage in sexual activity and attempting to send obscene materials to a minor in March. He worked for the Secret Service Uniformed Division and was assigned to the White House, where he sexted with the underage girls while on duty.

Moore was arrested in 2015.

According to the Justice Department, Moore had profiles on Meet24 and Kik, social media applications through which he talked with underage girls.

Delaware State Police detectives with the Delaware Child Predator Task Force created a profile on Meet24 and posed as a 14-year-old girl. Moore engaged in several chat sessions, some of which were sexual in nature, with the detectives on both apps over a span of two months.

He also sent images to the detectives, and one was sexually explicit, the Justice Department said.

After Moore was arrested, law enforcement discovered he had sent sexually explicit photos to and requested sexually explicit photos from a 14-year-old in Florida.

The former Secret Service officer engaged in the same behavior with two other teens, a 14-year-old girl in Texas and a 17-year-old girl in Missouri.