An Ocean County, N.J., man is facing federal charges for allegedly trying to build a pressure cooker bomb with plans to detonate it as part of his support for the Islamic State.

Gregory Lepsky, 20, of Point Pleasant, was taken into custody Feb. 21 after an incident in which he attacked his family's dog at their home, according to court documents.

He has been charged with attempt to provide material support to a terrorist organization, federal prosecutors in Newark said Friday.

Lepsky told investigators that he stabbed the dog because it was "dirty" in the view of Islam, that he was going to kill his mother, and that he had pledged allegiance to Allah, the documents said.

Lepsky also allegedly told them he had joined IS, and told medical personnel that "he was trying to be a suicide bomber, but the police caught him while he was planning the attack."

When investigators searched the residence, they found a pressure cooker and bubble wrap in Lepsky's closet, court documents said. Computer searches and statements from Lepsky revealed his plan to build and detonate the bomb, officials said.

On social media, Lepsky allegedly told others he planned to fight on behalf of IS and become a martyr if necessary by driving a "bunch of explosives" to a location with "enemies" and blowing himself up.

Investigators also found in his possession instructions on how to build a pressure cooker bomb and a message in which Lepsky forwarded another IS supporter's statement that westerners who cannot travel to Syria to support IS could conduct a terrorist attack at home.