ROCKLAND — A judge praised an agreement reached Wednesday that will result in a felony charge being dropped against a 62-year-old Rockland man who caused a regional school lockdown in May when he told a friend that voices in his head were telling him to shoot up a school.

The deferred disposition reached between the District Attorney’s Office and Brandon M. Luzzi means the single criminal count will be dropped in six months if he continues to receive mental health treatment.

Luzzi pleaded guilty Wednesday in Knox County Superior Court to a misdemeanor count of terrorizing. A felony terrorizing charge was dismissed.

The misdemeanor will also be dismissed in six months if Luzzi abides by the terms of the deferred disposition.

Justice Bruce Mallonee praised the decision to resolve Luzzi’s mental health condition rather than try to win the case at trial.

The felony terrorizing case had been scheduled to go to trial Wednesday.

Mallonee said he sees many people in court who have committed crimes related to mental health problems. Deputy District Attorney Jeffrey Baroody said the agreement follows District Attorney Natasha Irving’s policy of getting treatment for people with mental illnesses who are charged with crimes.

Baroody said that Luzzi’s mental health has improved substantially since the incident occurred.

The prosecutor also said that because the court had involuntarily committed Luzzi to a psychiatric treatment facility, he will be prohibited from possessing firearms.

Defense attorney Michael Harman said Luzzi was diagnosed with auditory canal hallucinations. A mental heath review also found there was a possibility he was experiencing early onset dementia, the defense attorney said.

The agreement allows Luzzi to return home on Thomaston Street, located across from the South Elementary School and Regional School Unit 13 athletic fields. But Harman said Luzzi plans to continue living with a friend in Oxford County, where he has been staying since being released from Riverview.

Luzzi had worked as a tugboat captain but he may not be able to return to that career because of the charge.

Baroody said he has been in contact with the superintendent of RSU 13, who generally supports the agreement.

Rockland police received a telephone call May 29 from a female acquaintance of Luzzi who said he had told her he heard voices telling him to do a school shooting. The woman told police that Luzzi was a hunter and had access to guns.

Police officers were sent to South School, Oceanside High School and the Mid-Coast School of Technology, all located in Rockland, and seized eight firearms – including high-powered rifles and a flare gun – and ammunition from Luzzi’s home.

An affidavit filed by Rockland police stated that Rockland Officer John Bagley went to Luzzi’s residence and Luzzi admitted he was hearing voices telling him to shoot up the school, but said that, “he is able to keep the voices at bay and is of no harm to anyone.”

Luzzi acknowledged that he had at least one hunting rifle in his residence, and was taken into custody after a brief struggle, according to the affidavit.

Luzzi has no criminal record, according to Baroody.