Texas prosecutors today agreed to throw out the convictions of 38 people, nearly all of them black, who faced drug charges based on the uncorroborated testimony of a white former undercover police officer.

In a stunning reversal, the state agreed with defense lawyers that the former officer, Thomas Coleman, was an unreliable witness even though his testimony was the only evidence used to convict the defendants, some of whom are serving sentences of 90 years or more.

Asked if the convictions represented a travesty of justice, the state's special prosecutor, Rod Hobson, hesitated a moment and then said, "Yes."

It was a dramatic turn of events in a racially charged case that erupted into the national spotlight when more than a tenth of the black population of Tulia, a poor farming town in the Texas Panhandle, was arrested on cocaine charges in a 1999 sweep.

Of the 46 people originally arrested, 22 received prison sentences and 13 of them are still incarcerated, all on the say-so of Coleman, a police officer with a checkered past who offered no fingerprints, audio or video surveillance, corroborating witnesses or other evidence to support his testimony. A number of experienced Texas lawyers said they had never before seen convictions in a major drug case rest on the uncorroborated testimony of one police officer.

Civil rights groups cried foul. Both the U.S. Justice Department and the Texas Attorney General's office launched investigations into the Tulia bust. But even as evidence emerged as to Coleman's unreliable testimony and questionable character, the investigations seemed to go nowhere, and the convicts languished in prison.

Judge Ron Chapman, a retired jurist from Dallas who was appointed to preside over a hearing on the case, accepted the two sides' stipulation today that Coleman "is simply not a credible witness under oath." Nonetheless, the Texas Court of Criminal Appeals has the final decision on the defendants, 27 of whom pleaded guilty after juries began handing out lengthy sentences to the defendants who first went on trial.

In a hearing in Tulia two weeks ago, Coleman took the stand and acknowledged there was no evidence beyond his testimony to support the convictions. He also acknowledged using a racial epithet to refer to blacks in conversations with his superiors.

When one of the defense lawyers asked him if he was sure all the defendants behind bars deserved to be there, Coleman replied, "I'm pretty sure." He also admitted to several "mess-ups" -- including false police reports -- that resulted in four other cases being dismissed.

The hearing turned into what seemed to many in the courtroom a trial of Coleman himself. He had run up a string of debts after quitting earlier jobs in law enforcement. He conceded that he once owned an illegal machine gun, and he was described by previous employers as dishonest, unreliable, a racist and, in one case, "a gun nut."

In a separate, civil rights case brought by one defendant, Coleman was asked in a deposition if he could affirm his earlier testimony at trial. He responded that some of his sworn testimony was "questionable."

Coleman, 43, could not be reached for comment today.

Technically, the hearing in Tulia last month was to collect evidence for a challenge filed by four defendants serving prison terms of 20 to 90 years. They sought to have their convictions overturned based on fresh evidence about Coleman's past.

"You can't rely on anything he says, even at the risk of letting a guilty person go," conceded the prosecutor, Hobson. "His testimony caused us confidence problems that undermined the integrity of the verdicts, and if you want to call that a travesty of justice, you can."

As a result, Hobson said the state would seek to vacate the convictions of all 38 defendants once prosecutors and defense lawyers formulate detailed "findings of fact" for Chapman to submit to the Court of Criminal Appeals. He said in the event new trials are granted by the court, the state would not again seek to prosecute any of the defendants.

Coleman was hired as an undercover officer by the Swisher County sheriff's office in 1998, and soon after that launched his 18-month investigation. It came into public view on July 23, 1999, when Coleman, wearing a ski mask, supervised the nighttime arrests of 46 people, 39 of them black, who he said had sold him drugs. Television cameras recorded many of the arrests.

For his work on the drug bust, he was named Texas's Lawman of the Year in 1999.

In the early trials, which resulted in swift convictions, no evidence was introduced about Coleman's record in law enforcement. Despite the fact that Coleman kept spotty records of his drug buys and that no drugs, weapons or large sums of cash were found to back up his testimony, tough sentences were imposed.

That, say defense lawyers, induced other defendants to plead guilty to a variety of charges.

It was an extraordinary turn of events in Tulia, a town of 5,000 midway between Amarillo and Lubbock. Blacks in the town, who number fewer than 400, were stunned by the drug bust, and many were adamant from the beginning that Coleman framed the defendants.

Dozens of Tulia's black residents attended the hearings earlier this month and heard testimony that confirmed their suspicion that Coleman was a racist.

"Not only did he use the n-word and other racial slurs to talk about black folks, but he did it in front of his superiors in the course of this investigation," said Mitchell E. Zamoff, a lawyer with Washington's Hogan & Hartson, which along with Wilmer Cutler & Pickering, another D.C. law firm, is handling a portion of the defense case pro bono.

Lawyers close to the case said that as part of today's agreement, Swisher County Commissioners Court would pay the defense $250,000, to be split among the defendants according to the amount of time spent incarcerated. In return, the defense would agree not to sue Swisher County, its sheriff or district attorney for civil rights damages.

Attorneys Jeff Blackburn, left, and Ted Killory discuss agreement to throw out drug convictions in Tulia, Tex.