Student, Matthew Vanderbeek, 19, from New Jersey has been arrested for allegedly threatening to shoot up his high school on graduation night

A student from a New Jersey high school has been arrested after allegedly threatening to shoot classmates and staff at his graduation ceremony.

Matthew Vanderbeek, 19, of Cream Ridge, faces charges of making terroristic threats with intent to kill and trying to get a firearm for an unlawful purpose.

The investigation moved quickly after proescutors began looking into threats made on Tuesday.

Detectives learned from postings online that the teen was trying to get a gun to use at his high school graduation.

Prosecutor's office Detective Brant Uricks and Plumsted police Detective Anthony Ringle investigated the threat, identifying Vanderbeek 'as the suspect who allegedly utilized social media to communicate his intention to shoot school students and staff.'

Law enforcement agencies then rushed to obtain a search warrant at Vanderbeek's home which confirmed that he indeed made the comments online and had been trying to get hold of a weapon.

Prosecutors say Vanderbeek allegedly made the threats via social media and planned to shoot up a graduation ceremony at New Egypt high school, pictured

Vanderbeek was taken into custody immediately and is now being held at the Ocean County jail pending a detention hearing.

The school, which is home to around 530 students between grades 9-12, say that there is no longer a threat to the school or graduation ceremony.

A letter from the superintendent was posted on the district's website describing the basics of the case and attempting to reassure parents that there would be increased security and police at graduation.

'We, as always, have the safety and security of our students first and foremost in our decision making,' Gerald North wrote. 'Please understand this situation was dealt with promptly and professionally to insure the safety at, as well as the memories from the graduation of the Class of 2018.'