A New Hampshire man arrested for allegedly punching a Planet Fitness employee nearly 40 times in June was released Tuesday on his own recognizance.

Erin McCarthy, 18, was leaving her job at the Rochester, New Hampshire, Planet Fitness around 10 p.m. on June 12 when police said Jordan Lamonde, 22, of Portsmouth, attacked her from behind, punching her 39 times.

>> Read more trending news

“This was a vicious, unprovoked attack that shocked our community, and I am proud to report that the suspect has been identified and apprehended,” Rochester Police Chief Paul Toussaint said.

Lamonde waived his arraignment, which was scheduled for Tuesday, and his lawyer worked out a deal so he could be released while he awaits trial. His lawyer entered a plea of not guilty.

Related: Man arrested for allegedly punching teen 39 times outside NH gym

Police believe that the attack is connected to an incident involving the victim’s now-ex-boyfriend and his older brother. Court documents released Tuesday reveal that a tipster told police Lamonde was “ripped off of $30,000 by someone.” Police are investigating whether Lamonde targeted McCarthy because her ex was related to “the one Jordan accused of stealing his safe that contained thousands of dollars.”

McCarthy did not suffer any major injuries as a result of the attack.

“I'm really glad he’s been arrested now. I feel like it took forever,” she said on Tuesday.

Lamonde lives with his grandparents in Portsmouth. He will be released under strict conditions, including GPS monitoring. His attorney, John Durkin, said that he has no prior convictions.