DARTMOUTH, Mass. (WPRI) — Dartmouth police have arrested an unregistered sex offender who was allegedly living in the woods behind an elementary school.

Robert Magrath, 47, was living in an encampment behind Potter Elementary School and has been charged with failing to register as a level three sex offender, according to police.

Police were tipped off about the encampment after hearing from the town’s Board of Health, who told 12 News they got a call from the school department. Dartmouth Public Schools told 12 News a parent notified the elementary school principal about the encampment, though it’s not clear how they learned of it.

Det. Kyle Costa told 12 News it’s “no secret” Dartmouth has a homeless population and there are several encampments around town. However, Magrath is listed as homeless in New Bedford.

Due to the proximity of the school, Costa said police sought to confirm there was an encampment and find out who was staying there. After staking out the area for two weeks, police determined Magrath was living there when they found him sleeping Thursday morning.

Magrath is on the Massachusetts sex offender registry and is supposed to check in every 30 days.

Court records show he was charged with indecent assault and battery on a child under 14 years of age back in 2018.

A few of Magrath’s relatives and his girlfriend were also found sleeping in the encampment, according to police. Costa said it doesn’t fall on the police to kick them out, but rather the property owner.

After 12 news spoke with several town departments and a nearby business, it’s still not clear who owns the property since the specific geographic location of the camp was not shared by police.

The first day of school for all Dartmouth Public Schools students is Aug. 31.