A federal judge on Monday slightly narrowed the classified documents case against former President Donald J. Trump, saying prosecutors cannot charge him based on an episode in which he is said to have shown a highly sensitive military map to a political adviser months after leaving office.

The decision by the judge, Aileen M. Cannon, was more of a swipe at prosecutors working for the special counsel, Jack Smith, who brought the case than a major blow to the allegations against Mr. Trump. Even though Judge Cannon technically removed the incident from the 53-page indictment, prosecutors may still be able to introduce evidence of it to the jury if the case finally goes to trial.

The incident that Judge Cannon struck took place in August or September 2021 at a meeting at Mr. Trump’s golf course in Bedminster, N.J. During the meeting, prosecutors say, Mr. Trump showed a classified map related to a continuing military operation to a representative of his political action committee, widely believed to be Susie Wiles, who is now a top adviser to Mr. Trump’s campaign.

As he displayed the map, prosecutors say, Mr. Trump told Ms. Wiles that the military campaign was not going well. The indictment pointed out that she did not have a security clearance at the time or “any need-to-know” about the classified information concerning the campaign.

The episode about the map, while indicative of Mr. Trump’s lax handling of classified materials, was not central to the formal allegations in the case. Those focus on his removal from the White House of nearly three dozen documents containing sensitive national security secrets and his repeated efforts to obstruct the government from retrieving them from Mar-a-Lago, his private club and residence in Florida.

Even though Judge Cannon struck the incident about the map from the indictment, she left untouched a similar allegation that is said to have occurred a few months earlier at Mr. Trump’s Bedminster property. In that episode, prosecutors say the former president showed a classified battle plan to a group of people who had come to interview him for a memoir being written by his former chief of staff, Mark Meadows.