The ad firm that ran NRATV has laid off 50 employees since parting ways with the gun-rights group, its lawyer said in court Wednesday morning.

That revelation came during a short hearing that ended with a narrow but hard-fought defeat for the NRA, and with the tentative scheduling of a deposition of the organization’s chief executive, Wayne LaPierre.

The hearing was part of a months-long legal battle between the gun-rights group and its former ad firm, Ackerman McQueen.

The two entities worked together closely for more than three decades, but their long relationship ended with an ugly break-up earlier this year, with both entities lobbing accusations of wrongdoing and suing each other for tens of millions of dollars.

The fight has already left significant collateral damage, according to David Dickieson, a lawyer for Ackerman McQueen. He said in court that the ad firm had to close its office in Alexandria, Virginia, after the NRA stopped paying its invoices and declined to extend it a $3 million line of credit.

In a hearing on June 26, Ackerman McQueen’s legal team predicted layoffs without an injection of cash from the NRA. But Judge Nolan Dawkins declined to require the NRA to pay the firm.

This morning’s hearing focused on what level of access the NRA’s outside law firm would have to materials that Ackerman McQueen shares with it as part of the pre-trial discovery process.

Ackerman’s lawyers said the firm doesn’t want Bill Brewer, the head of the NRA’s outside law firm Brewer Attorneys and Counselors, to see its highly confidential material. They argued that Brewer was competing with Ackerman to steal the NRA’s public relations work, and that he might misuse the sensitive information.

The NRA argued that Brewer needs access to everything the ad firm shares, and that his law firm was not competing with the ad firm. Judge Dawkins ultimately sided with Ackerman.

Brewer’s law firm has taken a key role in the dispute between Ackerman McQueen and the NRA. He represents the gun group on a host of legal issues, including its lawsuit against New York Gov. Andrew Cuomo over alleged threats to its banks and insurers.

The NRA’s senior leadership has praised Brewer’s work, noting in particular that the American Civil Liberties Union filed an amicus brief supporting its argument against Cuomo. But he’s also generated controversy; shortly before being ousted as president of the NRA, Oliver North alleged that Brewer was billing the group nearly $100,000 a day—an expense that he said posed an existential threat to the gun group. President Donald Trump also privately suggested to LaPierre that the gun group find better outside counsel.

LaPierre faces intense scrutiny for his leadership of the NRA, and is also central to the dueling lawsuits. The judge ordered this morning that he sit for a deposition by the week of Sept. 23.

“We view today’s decision as a positive development for the NRA,” says Michael J. Collins, partner at Brewer, Attorneys & Counselors and counsel to the NRA. “The ruling allows the Brewer firm to review all documents produced by Ackerman McQueen, and only limits the documents being made available to Mr. Brewer to those that are ruled to be highly-confidential.”

Collins added, “We are pleased to see the deposition of Mr. LaPierre will be scheduled in a manner that accommodates him and his many obligations to the NRA and its members.”

Ackerman and the NRA have also sparred outside of court. Last week, the gun group used—and then stopped using—Facebook ads featuring a video by Dana Loesch, an NRATV personality who worked for Ackerman. Loesch told The Daily Beast she was perplexed by the gun group’s use of her image.

Later, the NRA’s chief spokesperson sent a letter to the head of the ad firm demanding it “remove all references, direct and indirect” to its work for the NRA from its website.

“Despite the now obvious fact that the digital network built and run by Ackerman was an abject failure, your website creates the false impression Ackerman’s work on the ‘Second Amendment to the Constitution’ and ‘Second Amendment issues’ is endorsed by its former client—the NRA,” the NRA’s chief spokesperson Andrew Arulanandam wrote. “Nothing could be further from the truth.”

The NRA isn’t just facing internal fights. One of its top officials has privately predicted a tough battle over stricter gun laws in the coming weeks. That came in a letter the NRA’s general counsel, John Frazer, sent to its board members on Aug. 27 explaining the decision to move the organization’s upcoming board meeting—scheduled for mid-September—from Alaska to northern Virginia. The Daily Beast reviewed the letter.

“As details of the congressional schedule were revealed today, it became apparent that a fight of historic proportions is going to begin during the time when we would have been in Alaska,” Frazer wrote.

“It is imperative not only that officers and staff be fully engaged, but also that the full board lend its support and assistance. Being in Alaska would have made it impossible for our officers and senior staff to fulfill their duties here in the nation’s capital at this critical period in the Second Amendment’s history.”