HUNTINGTON STATION, N.Y. (CBSNewYork) — A homeless man accused of endangerment and luring a young girl inside a public library was arraigned Wednesday.

A mother was enjoying a day at the Huntington Public Library with her 4-year-old on Monday when police say the preschooler was nearly lured away.

READ MORE: 'Good France Week' Showcases French Food, Wine And More Throughout The Tri-State Area

Detectives told CBS2’s Jennifer McLogan that 30-year-old Jose Aparicio approached the child and gave her a stuffed animal. The homeless man then allegedly asked the little girl to come with him. Police said he was touching her hair.

The victim’s mother confronted him, and library staff called the police.

“The mother did an excellent job this time making sure she alerted authorities. Just so they can make a report, follow up on it, and see how serious the incident is,” said Town Supervisor Chad Lupinacci. “But this again is a teachable moment to remind students not to talk to strangers.”

“It’s scary and I just feel like I can’t enjoy my quality of life because I’m worried about what’s out there. It’s wrong and it’s sad,” Huntington grandmother Joan Fisher said.

READ MORE: COVID Vaccine Mandate Takes Effect For Workers At New Jersey Schools, Colleges, Universities And State Agencies

It’s the second case in as many weeks involving the homeless in Suffolk County. In Port Jefferson, a homeless man waving a large sword left the library there and confronted the owner of business across the street. The owner shot the suspect.

As a result of increases in the homeless population on Long Island in and around libraries and train stations, communities such as Huntington and Port Jefferson are now working closely with charitable organizations and community groups to find safe solutions, McLogan reported.

“I don’t know what the right solution is, but they need mental health. They need a place to stay,” Fisher said.

“We’ve taken various security measures, too, working along with our police department, our public safety team, our state officials to secure grant money,” Lupinacci said.

MORE NEWS: Law Enforcement: Suspect Arrested In Killing Of New Rochelle Taxi Driver Was Wanted For Crimes In Multiple States

Lupinacci said money for outreach and for security cameras that will be used to help deter crime, catch lawbreakers and keep neighborhoods safe.