NEWARK, N.J. (AP) — A New Jersey man who appeared on authorities’ radar after stabbing the family dog had plans to construct and use a pressure cooker bomb in New York City and, if necessary, become a martyr in support of the Islamic State group, federal prosecutors said Friday.

Gregory Lepsky, 20, of Point Pleasant, was charged with attempting to provide material support to a designated foreign terrorist organization. Investigators say he had praised the Islamic State group’s leader, Abu Bakr al Baghdadi, in online messages.

He was arrested in February after investigators said he stabbed and threatened to kill the dog. While searching the home, officers found a pressure cooker stored behind a roll of bubble wrap in his bedroom closet. They also searched his phone.

“Lepsky expressed regret for having tried to kill the family dog because, according to him, if he had not done so, the police would not have discovered his plan,” FBI agent Tara Jerussi wrote in a complaint filed Friday.

Investigators said Lepsky told police he stabbed the dog because it was considered “dirty” in his view of Islam.

Lepsky faces an initial court appearance Friday afternoon. There was no phone listing for him. If convicted, the charge carries a maximum penalty of up to 20 years in prison and a $250,000 fine.

Authorities said a search of his computer and social media yielded evidence Lepsky planned to detonate a bomb and fight on behalf of the Islamic State group.

“I linked up with some guy I met on a chat website and he wants me to become Muslim and join ISIS,” Lepsky said in message to someone, the FBI reported. “I really wanna go join ISIS.”

Law enforcement also said they found a series of instructions on how to build a pressure cooker bomb and a message forwarded by Lepsky from another Islamic State group supporter stating that if a Westerner could not travel to Syria to fight, “he could conduct a terrorist attack in his home country using improvised explosive devices.”

A search of his phone also found an image of a flag used by the Islamic State group and a photo of him holding firearms with his finger making a gesture used by Islamic State group members and supporters, investigators said.

He said in another Facebook message that his father was a Muslim from Chechnya, but stopped being religious when he moved to America.

“But I want to be different,” investigators said he wrote. “I want to be religious and grow up and be a martyr.”

Point Pleasant is 12 miles (19 kilometers) north of Seaside Park, where a pipe bomb exploded before the start of a charity military run last year. Ahmad Khan Rahimi, of Elizabeth, faces charges that he set off that bomb and planting two pressure cooker bombs in Manhattan that injured more than 30 people. He was arrested the next morning after a shootout with police in Linden, New Jersey.