BOSTON (AP) — Judges across Massachusetts are sealing court documents with increasing regularity, forcing news organizations and First Amendment groups into costly and time-consuming legal battles to ensure the basic workings of the judicial system remain public.

In the run up to Aaron Hernandez's ongoing murder trial in Fall River, for example, a judge sealed search warrants and hundreds of pages of related documents following the former New England Patriots star's 2013 arrest.

In Falmouth, similar documents were barred from release related to the Feb. 5 shooting of two Coast Guard officers and a local Bourne police officer by Coast Guardsman Adrian Loya.

In both cases, the defense lawyers argued that the release of information could harm their client's constitutional right to a fair trial. Judges eventually unsealed the records after news organizations challenged the rulings, but journalists say the documents should never have been secret in the first place.

"What we're talking about is some of the most basic public information that has been always presumed to be available and transparent," said Paul Pronovost, editor-in-chief of the Cape Cod Times, which prevailed in its challenge in the Loya case.

Advocates and news editors say it's not clear the extent of the problem or its causes.

Matthew Segal, legal director for the American Civil Liberties Union of Massachusetts, suggests the tendency toward secrecy stems, in part, from post-9/11 concerns about national security and how that thinking now pervades all levels of government across the country.

But he also submits that it is driven by factors unique to Massachusetts: The state has one of the weakest public records laws in the nation, and some government agencies have a tendency not to honor even those low standards.

"There isn't exactly a cheerful willingness to do what the law requires," Segal says. "You have to fight for every inch. The culture here does not favor openness."

News editors and First Amendment advocates say the problem is not exclusive to high-profile cases.

Justin Silverman, executive director of the New England First Amendment Coalition that counts lawyers, journalists and historians among its members, points to lesser known cases — from child custody disputes and domestic violence incidents — where news organizations across the region have lodged challenges, and, in many cases, won.

"What makes me nervous is in these lower courts where you're not able to get that media presence," he says. "What's going unnoticed? What information is being sealed that we will never know about?"

To be sure, not every case where court records are sealed raises red flags.

In the federal terrorism trial of Boston Marathon bomber Dzhokhar Tsarnaev, for example, many of the legal briefs filed by defense lawyers and prosecutors — as well as related decisions by the judge — have been sealed.

Advocates concede confidentiality is likely warranted in many of those instances. One notable exception: the Boston Globe, CNN and the radio station WBUR-FM filed a request earlier this month asking the judge to unseal the witness and exhibit list, which are normally made public.

"The information contained in the lists ... is not by its nature private since all of the exhibits are presumptively public and all of the witnesses will testify in open court," the news organizations argue in their filing.

And not all judges are erring on the side of secrecy.

In the case of Philip Chism, a Danvers High School student accused of killing his math teacher, a judge recently rejected a bid by defense lawyers to seal their client's videotaped police confession after news organizations objected.

"The First Amendment was not intended to make life easy," Superior Court Judge David Lowy wrote in his Jan. 23 decision. "The exacting scrutiny of the press ... in covering the courts and providing an unobstructed view of the proceedings, therefore, remains at the core of protecting ordered liberty, the rule of law, and ultimately not just democracy, but constitutional democracy itself."