After a boy died while riding a nearly 170-foot-tall waterslide in Kansas in 2016, state attorneys brought criminal charges against operators and associates of the water park, accusing them of recklessness.

But on Friday a judge dismissed the charges and said prosecutors had submitted “improper evidence.”

In his ruling, the judge, Robert Burns of Wyandotte County, wrote that there was “illegal evidence that should not have been presented to the grand jury” and called into question videos and expert testimony presented to jurors.

The case focused on a waterslide at Schlitterbahn Waterpark in Kansas City, Kan. The slide, known as Verrückt, which is German for “crazy” or “insane,” opened in 2014 and was marketed as the tallest waterslide in the world. Riders climbed 264 steps to the top before sitting in a raft that plummeted and then soared over a crest on its way to a runoff pool at the bottom.

The rafts sometimes lifted from the chute momentarily, and the slide was covered with netting, supported by metal poles, so riders would not fall off. But riders sometimes struck the netting or the poles, and some injuries had already occurred when, in August 2016, Caleb Schwab, 10, got into a raft with two other riders.