Like many unsolved cases in police files, the investigation of a July 14, 1996, rape in Montgomery County was difficult from the start. There were no witnesses other than the victim, no suspects and not much evidence. For years, as the case grew colder, said Detective Joseph Mundano, an arrest seemed increasingly unlikely.

Then the case thawed out.

In an unrelated arrest in January 2002, Charles Raines, then 38, was charged with assault, which resulted in the revocation of his parole in a 20-year-old robbery case. Under a Maryland law enacted in 1995 and later broadened, Raines was required to give authorities a DNA sample because he was a convicted felon who had been reincarcerated. The sample was sent to a state database for comparison with DNA evidence from unsolved crimes.

Technicians got a hit, authorities said. Raines's DNA allegedly matched genetic material from semen taken from the Montgomery rape victim. Last June, Raines was charged with the crime, in which a woman had been grabbed from behind on a Wheaton street late at night, choked into unconsciousness, dragged into bushes and sexually assaulted.

Early this year, however, an unusual ruling by a judge in Raines's case led to an indefinite postponement of his trial and set the stage for an appeals court hearing next month in which the future of Maryland's DNA database could be at stake. Raines's attorneys argue that forcing convicted felons to give DNA samples -- which officials said has helped solve dozens of crimes in the state since 1994 -- is unconstitutional.

"Maryland's DNA collection statute violates the Fourth Amendment precisely because it mandates search and seizure of an individual's DNA without any showing of individualized suspicion," the attorneys said in a court filing. "The status of a criminal conviction does not leave an individual in the state's custody without a reasonable expectation of privacy in his intensely personal and information-rich DNA."

After a pretrial hearing in Raines's case, Montgomery Circuit Court Judge S. Michael Pincus concurred with that argument in a Jan. 28 ruling. "Even a prisoner . . . retains an expectation of privacy in his body unless there is a reasonable cause to violate his bodily integrity and a legitimate penological interest in doing so," the judge wrote.

Pincus's legal opinion of DNA collection, which is not binding on other trial judges, deprived prosecutors of their only strong evidence against Raines. The judge agreed to stay his ruling while Maryland's attorney general challenges it before the state's highest court, the Court of Appeals.

Raines remains imprisoned in the 1982 robbery case while the rape trial and the state's appeal of Pincus's ruling are pending. Oral arguments are set for June 7.

If Raines prevails before the Court of Appeals, the prosecution's case against him probably would be lost. Barring intervention by the U.S. Supreme Court, Maryland authorities also could be forced to end or significantly scale back a nearly decade-old system of DNA collection that they consider an important crime-solving resource.

"To not be able to utilize a system like this is an absolute losing scenario for the public," said Capt. John Fitzgerald, a Montgomery police spokesman. "It can prove people guilty. But this technology also helps show innocence."

Leonard R. Stamm, president of the Maryland Criminal Defense Attorneys Association, said he knows of no other trial judge in the state who has ruled in favor of a constitutional challenge to Maryland's DNA database.

DNA collection systems are in place in every state and the District. Maryland's database, kept by the state police, contains nearly 17,000 samples from criminals and crime scenes. Defendants convicted of felonies or certain misdemeanors must provide DNA samples for storage and cross-checking in the database. Felons in state prisons -- even such criminals as Raines, whose felonies predate the DNA collection law -- must submit samples.

In cases challenging DNA collection elsewhere in the country, many federal and state appeals courts have rejected Fourth Amendment claims such as the one made by Raines. But a three-judge panel of the San Francisco-based U.S. Court of Appeals for the 9th Circuit agreed with the argument in a case involving the federal DNA collection system. The full court has taken up the case -- it heard oral arguments in March -- but has not issued a ruling.

A panel of the Philadelphia-based U.S. Court of Appeals for the 3rd Circuit recently heard arguments in a similar challenge to the law that requires federal prisoners and parolees to provide DNA samples to a database kept by the FBI. The federal database also samples from all the state databases -- more than 1.3 million samples in all.

Some legal experts said they believe the debate over DNA collection will wind up before the nation's highest court.

"It's almost inevitable that there's going to be some egregious case of misuse of this data, and there will be cutbacks," said Larry S. Gibson, a University of Maryland law professor and an expert in the rules of evidence.

"This tends to go in cycles," he said. "There are periods of time when Americans temporarily lose sight of the value of certain of their freedoms and liberties. But we tend to bounce back the other way, usually as a result of some governmental abuse."

Stephen D. Benjamin, board member of the National Association of Criminal Defense Lawyers, said challengers of DNA collection laws have been honing their arguments and probably will prevail eventually.

Because DNA can yield a wealth of information about a person's private traits, he said, "I think [databases] are a tremendous violation of privacy, and I don't trust the government to have that kind of information about me."

Law enforcement officials say such worries are unfounded.

"Our databank has been operating now for 15 years, and not once has there been even one allegation of any misuse," said Paul B. Ferrara, director of the Virginia Division of Forensic Science, which oversees that state's DNA database. "You have this rather ethereal, unspecific concern about some loss of privacy, and I'm not sure what that loss of privacy really is, particularly when weighing that against the clearly tangible benefits."

Virginia passed the nation's first DNA collection law in 1989 and last year mandated that all people charged with felonies, even those not yet convicted, submit samples. Ferrara said the Virginia database has helped solve more than 1,700 cases. In the District, officials began collecting DNA samples in 2001 from certain convicted felons, including sex offenders.

As for Pincus's ruling, Ferrara said, "I can understand why prosecutors in Maryland would be having a hissy fit," because the decision jeopardizes "the most powerful and valuable investigative tool to come along in 100 years for criminal investigations."

Mundano, the Montgomery detective, agreed. When he first started investigating the Wheaton rape that summer night in 1996, the database was in its infancy, and the possibility of identifying a suspect through a cross-check of DNA seemed far-fetched.

Now, as far as he is concerned, the case is closed.

The advantage that police get from DNA collection "is huge," he said. "It will identify suspects even if you had no clue who they were."