A man accused of shooting two New Hampshire police officers in 2016 was sentenced Thursday to at least five years in a psychiatric institution after he pleaded not guilty by reason of insanity. Ian MacPherson faced two counts of attempted murder for the shootings.

MacPherson, 33, shot Manchester Police Officer Ryan Hardy in the face, neck and back in May 2016 after the officer tried to question him about a robbery. Shortly after, MacPherson shot Officer Matthew O’Connor in the leg. MacPherson reportedly shouted “I’m your man” as he shot at O’Connor, according to CBS News.

Both officers survived and were present this week in Rockingham County Superior Court, the Associated Press reported. The officers did not speak at either the plea or sentencing.

Upon his arrest in 2016, MacPherson reportedly gave police a convoluted statement about mind control and fictional crime families, WMUR-TV reported. He was subsequently diagnosed as psychotic and delusional. After entering an insanity plea in December, MacPherson was sentenced Thursday.

MacPherson was expected to stay in the psychiatric facility for at least five years, at which point he would be reevaluated, according to WMUR.

“This is a very, very, very sad case,” said Judge Andrew Schulman. “That’s a really bad mixture: delusional, paranoid thinking and a .40 caliber handgun.”

MacPherson’s father, Russell MacPherson, told the New Hampshire Union Leader after the shooting that his son was diagnosed with schizophrenia as a teen and that he was in and out of a “revolving door” of psychiatric institutions. Russell MacPherson said he felt the system had failed his son.

“If, in fact, he’s the one who shot those policemen, it failed them as well,” he said.