The man had been harassing the girl for an "extended period" when she asked two customers for help, police said.