Updated

The man accused of killing five people at the Capital Gazette newspaper in Annapolis, Maryland, changed his plea Monday to not guilty by reason of insanity.

Lawyers for Jarrod Ramos said in a court filing that the 39-year-old Ramos was not criminally responsible "because of a mental disorder." Monday's filing in the Anne Arundel County Circuit Court also said he lacked the "capacity to appreciate the criminality of his conduct."

Five people were fatally shot in June 2018 in the Capital Gazette newsroom. Ramos was indicted on 23 charges in the attack, including first-degree murder. Ramos had initially pleaded not guilty, and the change of plea filed Monday maintains the not guilty plea.

If Ramos were ultimately found not criminally responsible, he could be confined to a mental health prison facility. A November trial has been scheduled.

Ramos has been charged with first-degree murder in the deaths of Gerald Fischman, Rob Hiaasen, John McNamara, Rebecca Ann Smith and Wendi Winters.

At a court hearing earlier this month, an attorney for Ramos made several references to his client's "bizarre language" and "bizarre behavior" leading up to the June 28 mass shooting. Attorney William Davis said Ramos had "longstanding" mental health issues and a period of "mental health disturbances." Davis also said a mental health expert has been working with the defense.

The state will conduct its own evaluation to determine whether Ramos was not criminally responsible. A doctor independent from the prosecution will write a report with recommendations and that report will then be sent to defense attorneys, prosecutors and the court.

Generally, a judge or jury would consider whether the defendant is not criminally responsible after the trial.

Prosecutors are seeking life in prison without possibility of parole.

Police said Ramos had used a shotgun to blast his way inside the newsroom. He also has been charged with attempted murder, assault and gun crimes.

According to prosecutors, Ramos carefully planned the attack and barricaded the rear exit of the office to prevent people from escaping. Police say they captured Ramos hiding under a desk at the Capital Gazette office after the attack.

Ramos, of Laurel, Maryland, had a well-documented history of harassing the newspaper's journalists. He filed a lawsuit against the paper in 2012, alleging he was defamed in an article about his conviction in a criminal harassment case in 2011. The Capital had published a story describing allegations by a woman who said Ramos harassed her online for months. The defamation suit was dismissed as groundless, and Ramos railed against staff at the newspaper in profanity-laced tweets.

In the days following the attack, area judges and an attorney received letters that threatened the newsroom and were signed with Ramos' name.