A Maryland man was sentenced to 20 years in federal prison after prosecutors said he hid tiny video cameras in his bathrooms, invited neighborhood children to backyard “splash parties” and secretly recorded more than 50 of them when they were nude and changing clothes.

Jonathan Oldale, 55, had been a fixture in the town of Somerset, an affluent enclave of 1,200 just outside Washington. With two children of his own, he also was involved in the lives of other kids in the neighborhood. He led a Cub Scout pack, took photos for the elementary school yearbook and volunteered as a room parent at school. He launched a small summer camp and threw the backyard splash parties.

“Jonathan Oldale invited children into his home in order to surreptitiously photograph them,” Robert K. Hur, the U.S. attorney for Maryland, said in a statement after Monday’s sentencing. “This sentence sends a clear message that we will bring to justice those who would victimize innocent children.”

His office had earlier described how children would become covered with grass during the water parties. “Oldale encouraged the children to change clothes or take showers before they went home,” prosecutors said.

Between May and July 2017, prosecutors said, Oldale recorded more than 1,000 videos using the hidden cameras. The images also showed children using a toilet.

Oldale hadpleaded guilty to one count of production of child pornography and one count of possession of child pornography.

The case surfaced in October 2017, when Montgomery County police announced Oldale’s arrest after several months of investigation. They asserted that, in May 2017, he had hidden a camera in a bathroom of the Silver Stars gymnasium in Silver Spring. An employee found the device, prompting a call to police.

According to court documents, the employee discovered a backpack containing the camera in the restroom near a toilet and under a wet-floor sign. The employee noticed a light coming from what appeared to be a key fob but which turned out to be a recording device, police said.

The backpack was traced to Oldale, who authorities say had left a backpack in a similar spot three weeks earlier. Police said no images were recorded at the gym.

Officers searched Oldale’s house twice in 2017, and seized electronic de­vices and memory cards.

Stored videos showed multiple cameras were used simultaneously to record what was happening in bathrooms in his home, authorities said. The videos captured him checking camera angles.

“Mr. Oldale would come into the bathroom,” Assistant U.S. Attorney Joseph Baldwin said in court at a previous hearing. “He will check on a camera. He’ll look down at it and make sure the focus is correct and make sure that it’s pointing in the right direction. He did it to the one in the pedestal sink. There’s another video where he comes in, and there’s one that’s pointing from the shower over the commode in the bathroom to the bathroom door. He walks in, he leans in that camera and he artfully pushes it back so that it’s now focusing on the shower.”

“You ask yourself, well, why is he doing that?” Baldwin continued. “Well, 30 seconds later, two young girls come in the bathroom, and they take off their bathing suits, and they get in the shower.”