Steve Schuh, county executive of Anne Arundel County, holds a copy of the Capital Gazette near the scene of a shooting at the newspaper's office in Maryland. (Patrick Semansky/AP)

Prosecutors will have access to tax, education and jail records for the Maryland man accused of killing five people in a shotgun rampage through the newspaper offices of the Capital Gazette.

A judge Wednesday granted prosecutors’ request for the records with some restrictions as they seek to fight defense assertions that Jarrod Ramos suffered a “mental disorder” at the time of the shooting inside the Annapolis-area newsroom.

Ramos, 39, faces five murder counts and several other charges and has pleaded not criminally responsible in the June 28, 2018, killings.

The issues were discussed during a day-long hearing in Anne Arundel County Circuit Court focused largely on what materials prosecutors could request that could prove whether Ramos was competent enough to understand the gravity of his alleged wrongdoing.

Ramos’s trial will be split into two proceedings, with one portion to determine guilt or innocence and the other to determine criminal responsibility.

Police say Ramos was driven by a grudge against the newspaper after a columnist wrote a story about his conviction in a stalking case involving a former high school classmate.

Ramos is accused of plotting the attack and carrying it out with a shotgun and smoke grenades. Police said Ramos blocked the exits of the newsroom to prevent people from escaping and was found under a desk in the office when officers responded to the shooting.

Five people were killed in the attack, which is believed to be the deadliest involving journalists in the United States in decades. Those slain were editorial page editor Gerald Fisch­man, 61; assistant editor Rob Hiaasen, 59; sportswriter, reporter and editor John McNamara, 56; sales assistant Rebecca Smith, 34; and reporter Wendi Winters, 65.

The hearing Wednesday was sometimes tense, with each side accusing the other of withholding or misrepresenting information. Prosecutors also said Ramos had threatened to kill an inmate who had been speaking with police about conversations he had with Ramos. Some of the conversations may reveal what Ramos was thinking or feeling during the time of the shooting, prosecutors said.

Prosecutors asked for Ramos’s tax records dating to 2003. Anne Arundel County State’s Attorney Anne Colt Leitess said the records will show that Ramos was competent — that he held down a full-time federal job and paid his taxes all while representing himself in a defamation lawsuit against the newspaper in the years preceding the shooting.

One of Ramos’s public defenders, Katy O’Donnell, argued that the state’s reason for asking for the records were based on “brazen” and “bald” statements and irrelevant.

The defense also tried to block the state’s requests for education and jail records, saying that the education records reach too far back in time and are not relevant and that the jail records would violate Ramos’s right to attorney-client privilege. The judge allowed education records subject to review for relevance.

The jail logs would have a detailed accounting of possible expert witnesses, social workers and attorney visits, possibly revealing confidential information about defense strategy, argued William Davis, Anne Arundel County’s public defender.

“Think of the chilling effect it would have across the state,” Davis said of prosecutors having access to details of when defendants interact with expert witnesses or medical professionals.

Anne Arundel County Circuit Court Judge Laura Ripken agreed to grant prosecutors access to the jail logs but will allow Ramos’s attorneys to redact any professional visits. Ripken also allowed prosecutors access to Ramos’s jail file, which would reveal information about his disciplinary history and interactions with guards and inmates. Prosecutors asked for the jail records in hopes of revealing whether Ramos has had any problems in jail that would indicate a potential lack of competency.

Defense attorneys on Wednesday successfully blocked the state’s attempts to hire a psychiatrist to evaluate Ramos’s mental health at the time of the shooting. Ramos is already being evaluated by a doctor with the state Health Department, sitting down for more than 20 hours of meetings over five sessions, O’Donnell said.

Prosecutors are not entitled to seek a second evaluation in the event the results from the state doctor don’t turn out in their favor, O’Donnell said.

Ripken agreed, saying there was not a good reason at this time to subject Ramos to a second mental health evaluation.