Two men accused of drug dealing had charges against them dropped Thursday after their attorney told a judge that five Philadelphia antinarcotics officers involved in their case had "partnered with drug dealers" in crime.

The action came two days after Police Commissioner Charles H. Ramsey transferred the five officers and a lieutenant from the aggressive Narcotics Field Unit.

District Attorney Seth Williams informed Ramsey by letter Monday that his office would no longer use the officers as witnesses, accept charges, or approve search warrants in narcotics cases in which they were involved.

At a hearing before Municipal Court Judge Charles Hayden on Thursday, the District Attorney's Office withdrew charges against Dan Kim and Sagar Patel.

In what could become a familiar scene in cases involving the officers, Kim and Patel - whose bail was set at $1.5 million at their arrest in January - walked out of the courtroom smiling.

Bradley S. Bridge, a veteran lawyer in the Philadelphia Public Defender's Office, said the affected cases could be in the hundreds.

Kim and Patel referred questions to their attorneys, Lawrence Krasner and Randolph L. Goldman.

In a statement to Hayden, Krasner said the five officers involved in Kim and Patel's arrest had been involved in criminal activity.

"There was a group of police officers who essentially partnered with certain drug dealers, and they partnered with those drug dealers to do things that were both illegal and outright crimes," Krasner said.

He said that Officer Thomas Liciardello, one of the officers pulled out of the Narcotics Field Unit this week, was "the mastermind" of the group.

Krasner said another officer removed from the unit, Michael Spicer, was Liciardello's "main enforcer. And there were other members of the Narcotics Field Unit who participated in the scheme."

Ramsey said Wednesday that he had transferred Liciardello, Spicer, Perry Betts, Brian Reynolds, and Brian Speiser to quieter, lower-profile units.

The lieutenant who oversaw the unit, Robert Otto, was transferred to South Detectives. Otto was not among the officers criticized by Krasner on Thursday.

In dropping the cases against Kim and Patel, Assistant District Attorney Brett Furbur told the judge that "the office, my higher-ups, have informed me the case is going to be withdrawn."

Krasner declined to elaborate on what he said in the hearing at the Criminal Justice Center. In open court, attorneys have immunity from lawsuits. The Inquirer could not independently verify Krasner's allegations.

Efforts to reach the five officers were unsuccessful.

The officers have the full support of their union, according to John McNesby, president of Fraternal Order of Police Lodge 5. He said the transfers were the result of infighting between the department and the District Attorney's Office, which took notice of the squad due to its aggressive approach toward clearing drug corners and houses.

"These guys were leading the squad, they're taking guns and drugs off the streets, and they were doing their jobs well," McNesby said. "If anyone had evidence that they were doing something criminal, they'd be in handcuffs right now. And now, because of this, we've got drug dealers in this city smiling from ear to ear."

The officers went to quieter Center City districts or the traffic unit, Ramsey said Wednesday, declining to discuss his reasons for ordering the transfers.

According to multiple sources, the District Attorney's Office informed Ramsey that it no longer wanted to call the officers to testify in drug cases, saying the officers' credibility was too badly damaged.

Tasha Jamerson, spokeswoman for Williams, said Thursday that his office would have no comment on any aspect of the events involving the transfer of the officers.

McNesby lashed out at Williams on Thursday, accusing him of second-guessing the work done by the narcotics unit and saying officers often work with drug dealers when targeting higher-level suppliers.

Williams "has no idea how to run the office," McNesby said. "He doesn't know the ramifications of what he's done. He's not just gotten these guys transferred, he's tarnished their careers."

Kim and Patel were arrested at the same time the antinarcotics unit had two other large marijuana cases.

Kim and Patel allegedly were buying marijuana from one of the larger operations, an accusation Krasner said was wrong.

Patel's attorney said his client had never been arrested and was still trying to get back his father's car, which was seized by police.

Michael C. Schwartz, a lawyer whose firm last year sued four of the officers, saying they planted drugs in a man's home, described them as having "a willingness to fabricate" facts and evidence.

Schwartz's client, Theodore Carobine, was arrested in July 2009 after Liciardello, Spicer, Betts, Reynolds, and three other officers conducted what was later determined to be an illegal search of his home. In an affidavit of probable cause to search his home, Liciardello alleged that they had witnessed Carobine handing someone a brown paper bag filled with methamphetamine. When they searched his house later, they reported finding a bag of the drug in a bedroom.

Carobine, who was 50 at the time and had no criminal record, denied the officers' account and ever having drugs in his home. Following a later hearing, a court determined that police did not have sufficient probable cause to search the house.

The stain on the officers' names could affect untold numbers of cases, Schwartz said.

"The implications of this are huge," Schwartz said in response to news of the prosecution's statements about the officers. "And not just in terms of future prosecutions. The real unknown is, how many convictions will be impacted?"

The accusations brought to mind the scandal surrounding five narcotics officers taken off the street in 2009.

Those officers have for more than three years been under federal investigation for alleged evidence-planting, illegal searches, and theft. One officer also is accused of groping several women during searches. Ramsey recently said he did not expect the investigation to continue.

The alleged activities of the narcotics unit were spotlighted in a series of Pulitzer Prize-winning stories in the Philadelphia Daily News, based in part on interviews with a criminal informant who claimed he and veteran narcotics Officer Jeffrey Cujdik sometimes falsified information to get search warrants approved.

Later the owners of several bodegas came forward, reporting that the squad had robbed their stores under the pretense of searching for plastic ziplock bags used for packaging drugs. The officers cut the wires of store cameras to mask their conduct, those merchants said.

As members of the highly aggressive Narcotics Field Unit, Cujdik and the other members of his squad made dozens, sometimes hundreds, of arrests per year.

The Public Defender's Office has since filed court petitions to overturn at least 55 criminal convictions involving arrests by those officers. The matter is before the Pennsylvania Supreme Court. The city has also settled 21 lawsuits for about $1 million from that scandal.

That pales by comparison with the more than $4 million that was paid out during the 39th District scandal of the late 1990s. In that case, five district officers who worked narcotics cases were convicted of federal corruption charges.