Lawyers for the man accused of fatally shooting five people in the newsroom of The Capital Gazette last year invoked an insanity defense on Monday, saying in a court filing that he should not be held criminally responsible for the shooting because of a mental disorder.

Jarrod W. Ramos, 39, faces five charges of first-degree murder in the June 28 shooting at the Annapolis, Md., newsroom, considered the deadliest attack against journalists in United States history.

Before he blasted his way into the newsroom offices with a 12-gauge shotgun, the authorities said, Mr. Ramos sent a number of letters, including one to The Capital Gazette's lawyer that said he planned to go there “with the objective of killing every person present.”

Mr. Ramos pleaded not guilty in July.

Monday’s court filing enters an additional plea of “not criminally responsible” because a mental disorder either prevented him from appreciating the “criminality of his conduct” or prevented him from following the law at the time of the shooting.