Lawyers for former President Donald J. Trump are engaged in a behind-the-scenes legal struggle to limit the scope of a federal grand jury investigation into the role he played in seeking to overturn the 2020 election, according to people familiar with the matter.

The closed-door battle, unfolding in Federal District Court in Washington, has centered on how far Mr. Trump can go in asserting attorney-client and executive privilege as a means of keeping witnesses close to him from answering potentially damaging questions in their appearances before the grand jury, the people said.

The issue is important because it will determine how much evidence prosecutors can get from an inner circle of some of Mr. Trump’s most trusted former lawyers and advisers. The outcome will help to shape the contours of the information that the Justice Department will be able to gather, as it looks into Mr. Trump’s involvement in the chaotic events after the election that culminated in the attack on the Capitol on Jan. 6, 2021.

That process continues even as the Justice Department also pursues a separate criminal investigation into Mr. Trump’s handling of government documents that he took with him when he left office, including hundreds marked as classified.

A federal appeals court this week blocked a lower court’s order that had stalled a key portion of the documents investigation. And on Friday, the Office of the Director of National Intelligence said that the intelligence agencies had resumed a risk assessment of the classified material seized in the search last month of Mar-a-Lago, Mr. Trump’s residence and private club in Florida. The work involves assessing the potential national security risk that would result from disclosure of the documents, the office announced.

The court appearances by the lawyers in the battle over how expansively Mr. Trump would be able to claim privilege in the Jan. 6 investigation, as first reported by CNN, are proceeding under seal, like all matters concerning grand juries. As a general rule, issues that touch on federal grand juries in Washington are overseen by the district’s chief judge, Beryl A. Howell.

The court fight comes as an increasing number of high-ranking officials in Mr. Trump’s administration have received grand jury subpoenas as part of the Justice Department’s inquiry into a wide array of efforts to overturn the election, including a plan to create fake slates of pro-Trump electors in key swing states that were won by Joseph R. Biden Jr.

This month, more than 40 subpoenas were issued to a large group of former Trump aides — among them, Mark Meadows, Mr. Trump’s final chief of staff; Dan Scavino, his onetime deputy chief of staff for communications; and Stephen Miller, Mr. Trump’s top speechwriter and a senior policy adviser.

The wide-ranging subpoenas sought information on a host of subjects that included the fake elector plan, attempts to paint the election as having been marred by fraud and the inner workings of Mr. Trump’s main postelection fund-raising vehicle, Save America PAC.

The recent flurry of subpoenas came only days after Pat A. Cipollone, the chief lawyer in Mr. Trump’s White House, and his former deputy, Patrick Philbin, testified before the grand jury. In July, two top aides to former Vice President Mike Pence — Marc Short, Mr. Pence’s onetime chief of staff, and Greg Jacob, his former chief lawyer — also appeared in front of the grand jury.

While the legal wrangling in front of Judge Howell is meant to be secret, three of Mr. Trump’s lawyers — M. Evan Corcoran, John Rowley and Timothy Parlatore — were seen on Thursday leaving the federal courthouse in Washington. Their appearance there was related, at least in part, to discussions about whether Mr. Trump’s assertions of privilege could limit the testimony of Mr. Short and Mr. Jacob, according to a person familiar with the matter.

Mr. Parlatore declined to comment. Neither Mr. Corcoran nor Mr. Rowley returned messages seeking comment.

Last week, The New York Times reported that Eric Herschmann, another lawyer who had worked in Mr. Trump’s White House, spent weeks this summer trying to get specific guidance from Mr. Corcoran, Mr. Rowley and Mr. Parlatore on how to handle questions that might raise privilege issues since he, too, had been summoned before the grand jury.

In emails reviewed by The Times, Mr. Herschmann complained that a letter from Mr. Trump directing him to assert privilege in front of the grand jury — as other witnesses had — was not enough to allow him to avoid answering questions.

“I will not rely on your say-so that privileges apply here and be put in the middle of a privilege fight between D.O.J. and President Trump,” Mr. Herschmann, a former prosecutor, wrote in one of the emails, referring to the Justice Department.

Mr. Herschmann repeatedly implored Mr. Corcoran and Mr. Rowley to go to court seeking an order from a judge “precluding me from answering questions based on privilege assertions by President Trump,” according to the emails. They ignored his request for many days, before ultimately filing a motion under seal on Sept. 1, just hours before Mr. Herschmann was set to testify, the emails showed. Mr. Herschmann’s grand jury appearance was postponed.

Attorney-client privilege is not an ironclad protection for lawyers and can be swept aside in cases where crimes have been committed. In July, for instance, a federal judge in California denied the attorney-client privilege claims of the lawyer John Eastman after finding that Mr. Eastman and Mr. Trump had likely conspired together to obstruct the certification of the presidential election on Jan. 6. Under the judge’s decision, Mr. Eastman was forced to give the House select committee investigating Jan. 6 a trove of his emails.

In a somewhat similar fashion, Mr. Trump asserted executive privilege over a batch of his White House records that the House committee wanted to examine as part of its inquiry — even though Mr. Biden, as the current president, had waived executive privilege over the documents.

In January, after lower courts had weighed in, the Supreme Court effectively rejected Mr. Trump’s claims and allowed the committee to use records. But an opinion by Justice Brett M. Kavanaugh that accompanied the decision suggested that Mr. Trump should have some residual power to assert executive privilege.

“A former president must be able to successfully invoke the presidential communications privilege for communications that occurred during his presidency, even if the current president does not support the privilege claim,” Justice Kavanaugh wrote. “Concluding otherwise would eviscerate the executive privilege for presidential communications.”

Julian E. Barnes contributed reporting.