A judge has strongly rebuked Fairfax County police and prosecutors for taking nine months to disclose key evidence that shows that an 18-year-old accused of first-degree murder might have acted in self-defense when he fatally shot a man in Springfield last year.

The commonwealth violated its legal duty to provide exculpatory evidence to Kelvin Omar Gonzalez in a timely fashion and irreparably damaged his ability to mount a defense at his Jan. 5 trial, Fairfax County Circuit Court Judge Thomas P. Mann wrote in an opinion this month.

A witness told police immediately after the Thanksgiving 2019 shooting that the victim, Ever Deras-Borjas, 30, had a knife and that Gonzalez, then 17, warned him, “Don’t get close, I have a gun,” according to the opinion.

But police and prosecutors did not tell the defense about the witness until August, when the account was included on Pages 96 and 97 of a 99-page supplement of evidence handed over days before a preliminary hearing, according to the opinion. The defense, prosecutors and police have subsequently been unable to locate the man so he can testify at trial.

Mann declined a defense request to drop the case, but the judge took the unusual step of ordering that a statement be given to the jury at the upcoming trial that lays out the missing witness’s testimony and explains how police and prosecutors failed to disclose it for months.

“The Commonwealth buried its head in the sand,” Mann wrote in his opinion. “This witness was bad for their case.”

The opinion is of particular note because Fairfax County Commonwealth’s Attorney Steve Descano won office last November promising to end “trial by ambush,” or prosecutors springing evidence on defendants too late in the process to prepare an adequate defense. Descano lamented in his platform that in Virginia, “defendants are not entitled to know witnesses against them and what the police investigation has uncovered.”

The case against Gonzalez began before Descano took office in January, but Mann sharply criticized Descano’s office for not being more proactive in highlighting and turning over the exculpatory evidence. The case is being handled by Deputy Commonwealth’s Attorney Jessica Greis-Edwardson.

Descano’s office said in a statement that it takes its duty to inform defendants of exculpatory evidence very seriously and placed blame for the failure on the office of Descano’s predecessor, Raymond F. Morrogh.

The statement said that police notified Morrogh’s chief deputy, Casey Lingan, of the witness in November 2019 but that Lingan failed to note it or tell anyone. The statement said Morrogh’s office was also unwilling to provide comprehensive briefings on major cases as Descano’s team took over.

“This was a case of past failures, a lack of communication, and unexpected evidence that was introduced late and brought about a bad result,” Descano said in a statement. “If a prosecutor in this office ever faces that situation again, they need to meet those challenges with an overwhelming eagerness to correct the shortcomings of our criminal justice system.”

In response to a request for comment, Lingan wrote in an email that the case was assigned to Greis-Edwardson before Descano took over so no briefing was needed, but he did not address Descano’s office’s other contentions about how he personally handled the case. Greis-Edwardson has been a prosecutor in Fairfax County since 2009.

“Mr. Descano’s campaign ended over a year ago and I truly hope that Mr. Descano soon focuses on the job he was elected to do and ceases his attacks on the previous administration,” Lingan wrote. “The victims, defendants, and community at large deserve as much.”

Fairfax police said in a statement that they are reviewing the judge’s ruling “along with all case records and actions taken in this case.”

“The Fairfax County Police Department prides itself on requiring the highest level of ethical and professional standards and our detectives work meticulously to investigate and present all criminal matters consistent with our commitment to ethics and integrity,” the statement read.

The killing took place Nov. 28, 2019, outside an apartment complex in Springfield. Descano’s office wrote in a filing that a second witness — not the one at the heart of Mann’s ruling — told investigators that he saw Deras-Borjas and another man walk over to Gonzalez.

A conversation ensued, and the second witness said Gonzalez then pulled out a gun and fired at Deras-Borjas twice, according to the filing. That witness said ­Deras-Borjas was unarmed. Gonzalez fled, and Deras-Borjas died at the scene. A box cutter was found near his body.

Gonzalez was arrested in North Carolina and extradited to Virginia, where he is being tried as an adult. Police and prosecutors have not detailed a motive for the shooting in news releases or filings.

Robert C. Whitestone, an attorney for Gonzalez, said that his client acted in self-defense and that Deras-Borjas approached Gonzalez with his arms out and his fists balled before the shooting. Whitestone said his client is 5-foot-4 and 110 pounds, while Deras-Borjas was about 6-foot-3 and about 210 pounds.

The day of the shooting, a Fairfax police detective, John Vickery, interviewed the missing witness, who offered a different account than that of the second witness. The missing witness said that Deras-Borjas had a knife and that Gonzalez told him to stay away before the shooting, according to the opinion.

Vickery got a phone number for the man but no other details and never attempted to follow up with him, according to the opinion. The missing witness apparently did not know either Gonzalez or Deras-Borjas.

The commonwealth began providing evidence in the case to Whitestone in January, but Vickery only filed his supplement containing the account of the missing witnesses in July, according to the opinion. Greis-Edwardson sent it to Whitestone 31 days later, on Aug. 18.

Greis-Edwardson did not respond to a request for comment, and media requests sent to the commonwealth’s attorney’s office are typically handled by the chief of staff.

Whitestone said he was stunned when he discovered the information about the first witness “buried” near the end of the 99-page supplement. Descano’s office said it was happenstance that the material appeared at the end of the filing.

Whitestone said he tried to find the witness but could not, because he was not provided with contact information for the man. He said the lack of information angered him.

Under the 1963 Supreme Court decision Brady v. Maryland, prosecutors have a duty to disclose exculpatory evidence to defendants. Whitestone said he thought it was clearly a Brady violation to not provide contact information for the first witness. He also said Descano’s office had not fulfilled his campaign promise to be more transparent with defendants.

“I think Steve Descano’s platform was full disclosure,” White­stone said. “I don’t think that was done in this case.”

Whitestone filed a motion to quash the indictments against Gonzalez in October, arguing that the commonwealth had deprived his client of a fair trial by failing to provide the exculpatory evidence. Whitestone was also concerned because the knife found at the scene was never tested for fingerprints or DNA that might have linked it definitively to Deras-Borjas.

Greis-Edwardson argued in her reply to the motion that the commonwealth had not committed a Brady violation because it provided the account of the missing witness months before the trial. She argued that Brady did not require the commonwealth to provide the witness’s contact information or test the knife.

After a hearing on the motion Oct. 23, Greis-Edwardson provided Whitestone with contact information for the first witness and agreed to send the knife for fingerprint and DNA testing.

Then, on Nov. 4, Mann sided with Whitestone in his forcefully worded opinion, saying that the commonwealth should have provided the missing witness’s account earlier and sent the knife for testing.

“Here is the problem: we do not abide sham trials,” Mann wrote. “We do not wink and nod at fairness and justice. . . . If just outcomes are the correct outcomes, whatever the result, it must be through a process that views prosecutorial obligations as hallowed rather than an inconvenient but necessary duty.”