A judge dismissed child pornography charges Thursday against one-time JonBenet Ramsey murder suspect John Mark Karr after prosecutors said they did not have enough evidence to take the case to trial.

Judge Rene Chouteau ordered Karr released immediately, bringing an end to his two-month odyssey in the U.S. criminal justice system after he was extradited from Thailand on suspicion of killing JonBenet.

Karr, 41, was returned to Sonoma last month to face the five-year-old case after DNA evidence cleared him of killing the former child beauty queen in her Boulder, Colorado, home in 1996.

The Sonoma case fell apart almost as quickly, as investigators admitted losing vital computer evidence that was seized from Karr in April 2001 when he was working as a substitute teacher in Sonoma and Napa counties.

Defense lawyers tried twice unsuccessfully to get the charges dismissed and were seeking to have evidence barred from trial when prosecutors gave up.

"The impression that we've had all along is that the prosecution had every intention of getting this case to trial, regardless of the evidence," said defense lawyer Robert Amparan. "I am pleasantly surprised by them having done the right thing."