POLK COUNTY, Fla. (WFLA) — “This is why pretrial detention exists,” declared prosecutor Tim Coleman during a pre-trial detention hearing Monday in Bartow.

Coleman attempted to show Robert Miranda, 42, is too dangerous to be released before trial.

“He is a danger to the community. He is a danger to the children of the community,” said Coleman.

Miranda, a registered sex offender since the early 2000s, is accused of driving up to people, including children, on three occasions and engaging in lewd behavior while exposing himself in Winter Haven last month.

On one occasion, prosecutors said he asked a 9-year old girl if she was missing a puppy.

He had one in the back of his vehicle, he said, according to authorities.

“The 9-year old child became afraid, understood that the subject was trying to get her inside the vehicle,” testified Polk County Sheriff’s Office Detective Jose Joglar in court.

Authorities also allege Miranda exposed himself to a 12-year old boy.

Both alleged incidents involving children occurred during the same morning in February while the children were walking to the school bus stop.

Prosecutors said Miranda removed his vehicle tag before the encounters.

Authorities tracked him down in Titusville using footage from a school bus camera that captured his vehicle once he had put the tag back on, according to testimony in court.

The vehicle was registered to his mother, who owns a used car auction in Polk County.

Prosecutors said Miranda did not update his sex offender registry with this vehicle or the home he was staying at for several days during the week in Polk County.

“You couldn’t have a more ideal candidate for pre-trial detention than a sex offender that’s trying to avoid detection by law enforcement by wearing a mask and taking off his vehicle tag,” said Coleman.

Miranda’s defense attorney, Ricardo Alvarez, argued while the behavior could be considered “despicable,” it did not rise to the level of attempted kidnapping, which was the only charge that qualified for pre-trial detention.

“There’s no attempt by him to grab her, to tell her to get in the vehicle,” he said.

The judge found Miranda posed a threat of harm to the community and therefore no conditions of release could be set that would guarantee the community’s safety.

She granted the state’s motion for pre-trial detention which means Miranda will remain behind bars pending trial.