The National Rifle Association’s former marketing firm must hand over records that New York State Attorney General Letitia James subpoenaed seven months ago, a judge ruled on Monday.

The marketing firm, Ackerman McQueen, initially expressed willingness to comply with the subpoena, but the NRA objected, insisting that it had a right to examine the documents before they went to James, who is investigating possible financial misconduct at the gun rights group.

“The court has stopped the NRA from acting as a set of virtual eyes and ears over our investigation and rejected the NRA’s demand to preview information in response to a lawful subpoena,” James said in a statement. “We won’t allow the NRA to control or intimidate witnesses’ responses to subpoenas or compromise the integrity of our investigation.”

Brewer, Attorneys & Counselors, which handles the bulk of the NRA’s legal work, did not immediately respond to a request for comment.

In July, the attorney general subpoenaed Ackerman for “documents relating to potential misconduct by the NRA, its directors and officers, and its affiliated entities,” according to court records. While the NRA and Ackerman were allied for decades, the relationship turned ugly in early 2019 and the parties are now embroiled in four lawsuits and related legal skirmishes.

The dispute accelerated following revelations about how the gun rights group, a nonprofit that collected $170 million in member dues in 2018, has handled its money.

The NRA has argued that some of the materials that Ackerman was being asked to produce related to three lawsuits in which it and Ackerman have a shared interest and were therefore privileged. Manhattan Supreme Court Judge Melissa A. Crane agreed to review any such records in her chambers to ensure that nothing inappropriate is provided to investigators.

That, however, was the lone concession to the NRA in her order. Crane ruled that the NRA’s concerns about Ackerman inadvertently turning over information regarding its donors were trumped by the attorney general’s “authority to conduct a confidential law enforcement investigation without interference and monitoring.” Similarly, Crane rejected the NRA claim that a non-disclosure agreement it had with Ackerman gave it a right to examine documents before they were handed over to investigators. “To allow not-for-profit entities, like the NRA, to shield its conduct through use of an NDA,” Crane wrote, “would frustrate [the attorney general’s] regulatory and law enforcement duties, and its oversight of charities.”

The attorney general of Washington, D.C., Karl Racine, is also investigating the NRA for possible violations of nonprofit law. And members of Congress have sought records that could shed light on the group’s financial practices and adherence to charities law.

Ackerman McQueen “is committed to assisting all of the myriad ongoing government investigations of the NRA,” the company said in a statement. “Today’s ruling will assist in the process of ridding Ackerman McQueen of the NRA’s unnecessary restrictions on cooperation with the authorities.”