IN POPULAR LORE, good trial lawyers — think Perry Mason and his ilk — never ask a question to which they don’t already know the answer. In real life, it happens all the time.

Prosecutors in some states are notorious for practicing “trial by ambush,” springing testimony in court to which the defense has had no previous access. Thus hamstrung, defense lawyers sometimes grope for exculpatory nuggets in cross-examination.

This makes for tilted justice, and at least occasionally it results in gross errors and tainted convictions. A prime recent example in Virginia is the case of Justin Michael Wolfe, a drug dealer sentenced to death in 2002 for ordering the murder of an associate. In 2011, U.S. District Judge Raymond A. Jackson threw out the conviction and sentence, finding that prosecutors in Prince William County suppressed and manipulated key evidence — especially exculpatory statements by their star witness — that would likely have helped Mr. Wolfe’s defense.

Last week the same judge barred Virginia from seeking to retry Mr. Wolfe and ordered him released. Although the state is mounting a last-ditch appeal to keep him behind bars, the original missteps by prosecutors, apparently compounded by more recent ones, may have undermined the case against Mr. Wolfe permanently.

Judge Jackson was irate that just this fall prosecutors had threatened the star witness — who was also the triggerman in the murder — with the death penalty unless he fingered Mr. Wolfe for ordering the hit. These were the same prosecutors who, in the view of the U.S. Court of Appeals for the 4th Circuit, had earlier suppressed critical evidence that would have cast grave doubt on the testimony against Mr. Wolfe. At this point, it may be impossible to know whether Mr. Wolfe is guilty.

The integrity of the criminal justice system depends on avoiding such bungles. But under Virginia’s rules, the chances of further miscarriages of justice are too great. That’s why the state Supreme Court, which makes and enforces the rules governing pretrial disclosure, should step in to tighten and clarify them.

A proposal by Virginia defense lawyers would compel prosecutors to grant defendants and their attorneys readier access to police reports following indictments, including witness statements in the aftermath of alleged crimes. That seems reasonable, provided that prosecutors are able to withhold the identity of certain witnesses out of concern for their safety.

Federal courts have gradually expanded the rights of defendants and their lawyers to gain timely access to certain police information. And federal prosecutors, mindful of high-profile convictions that have been overturned because of DNA evidence, have adopted a broader view of what information they are obliged to hand over ahead of trial. That’s in line with Supreme Court rulings that prosecutors may not withhold information that might stand in the way of a conviction.

Prosecutors in Virginia have balked at the proposed rule revisions, and Republicans who control the General Assembly are unlikely to force the state Supreme Court’s hand. That’s why it is incumbent on the court, at its own initiative, to revisit the rules to minimize the chances of a repetition of cases like Mr. Wolfe’s.