But after the veteran homicide detective sought a court order allowing him to testify, prosecutors relented.

And when Smit resigned from the investigation, District Attorney Alex Hunter's office asked a judge to impose a gag order on the retired detective, prohibiting him from talking about the case. It was the only gag order Hunter sought.

Ultimately, Smit and Hunter's office agreed Smit would not talk publicly about the case until charges were filed. The agreement stated if no charges were filed by Oct. 1, 1999, Smit "shall be free to disclose any information to anyone," but cannot reveal conversations he had with anyone working for Hunter's office.

The agreement, the request for an injunction against Smit, and Smit's request to testify had been kept under seal until Tuesday, when both sides agreed to a Denver Post request to open the file.

Hunter said Tuesday his office sought the injunction because "we didn't think it would be appropriate for someone to be talking about the case" during the grand jury investigation.

Even though Smit's original contract forbid him from talking about the case, Hunter said he had reason to believe Smit would, but declined to elaborate.

Grand jury witnesses are forbidden by state law from revealing their testimony. Hunter said Tuesday that as far as he knows Smit "has not violated that." Hunter invited Smit to work on the investigation in March 1997. He resigned more than a year later, saying he was upset that the police and Hunter's office discounted evidence that didn't point to the Ramseys.

JonBeneï¿½t's parents, John and Patsy Ramsey, have continually made similar criticisms.

Boulder Police Chief Mark Beckner has said those allegations are "simply false." Hunter said his office didn't seek similar gag orders against Boulder police who left the department because the terms of police officers' employment put them in a different legal status than Smit, who was under contract.

According to the court file, Smit wrote a letter asking to present his intruder theory to the grand jurors. However, Michael Kane, who was leading the investigation, told Smit in a letter that the grand jury was not interested in hearing from him.

Kane eventually agreed to allow Smit to testify, Smit's attorney, Bob Russel said Tuesday.

After he left the investigation in September 1998, the DA's office tried to force Smit to turn over all his files, photographs and other materials collected while he worked on the case.

As part of the agreement, Smit was allowed to keep one copy of a presentation he made to prosecutors and could continue investigating the murder as long as he made it clear he was acting on his own and not on behalf of the police or the DA. In exchange, Smit agreed to return his copies of the case timeline and police lead sheets.

Smit, who could not be reached for comment, has repeatedly said he believes an intruder broke into the Ramseys' home and beat and strangled 6-year-old JonBeneï¿½t. Her body was found in her parents' basement Dec. 26, 1996.

The 13-month grand jury probe into her death ended Oct. 13, 1999, without anyone being indicted. At the time, some reports suggested it was Smit's testimony that swayed the jurors.