NEWARK, N.J. (AP) — New Jersey officials arrested a man on charges he took an unattended car with a sleeping 2-year-old girl inside before the vehicle and child were recovered soon after, they said Sunday.

Sanders Martin Gomes, 40, was charged with carjacking in the July 10 incident, Newark Public Safety Director Anthony Ambrose said in a statement.

Police got involved in the incident, which happened in in Newark, after a 24-year-old Union woman reported she had parked a car containing her sleeping daughter near a relative's house to unload groceries.

At one point the car went missing, but was discovered soon nearby with the girl inside. Neither the woman nor her daughter was identified by officials.

The toddler appeared to be unharmed but was taken to a hospital to be examined, authorities said.

Gomes was arrested after a tip from a resident and taken into custody while he was getting a haircut at a barbershop, according to Ambrose.

Gomes was also wanted on outstanding warrants, which were not identified by officials.

He faces carjacking and child endangerment charges, Ambrose said. He also faces drug charges stemming from heroin, crack cocaine and cocaine that officials said they discovered when they arrested him.

It is not clear whether Gomes has an attorney to comment on his behalf.