The Mastic man who allegedly threatened to hurt himself and others Tuesday at Tanger Outlets contacted an acquaintance who alerted police to the man’s threats, Riverhead Town police said Wednesday.

Riverhead Detective Sgt. Joseph Loggia said John Medina, 32, voluntarily gave himself up to police when he was approached at the shopping center and told police he “knew what he was feeling was wrong.”

“He’s a veteran who has some issues,” Sgt. Loggia said. “He’s definitely struggling.”

Police were called to the Route 58 shopping complex about 12:45 p.m. and found Mr. Medina at the Tanger Outlet II food court.

Mr. Medina told police he had a machete in his backpack at the time. Mr. Medina told responding officers he wanted to hurt others and hurt himself, police said Tuesday night.

The man never took the machete out of his backpack, Sgt. Loggia said.

Mr. Medina, who works at the Levi’s outlet store in the shopping center, contacted an acquaintance and explained he was having disturbed thoughts, Sgt. Loggia siad. The acquaintance then called the police to alert them to Mr. Medina’s condition.

Mr. Medina was arrested and charged with making a terroristic threat, a Class D felony punishable by up to seven years in prison, and a misdemeanor criminal possession of a weapons charge, police said.

He was arraigned in Justice Court and is being held at the county jail.

“We are thankful that no one was hurt,” said Janine Nebons, the Riverhead outlet center’s general manager. “The incident is under police investigation. We appreciate your patience while the police investigation is underway.”