FRESNO, Calif. (KFSN) -- City leaders are wondering how they didn't see or suspect the drug activity that was allegedly happening.

Fresno Police Deputy Chief Keith Foster appeared tired and somber on Friday when he faced a federal judge. At times, he closed his eyes like he was praying throughout the proceedings. Foster was set free Friday afternoon on three conditions: he must attend therapeutic counseling, he cannot be around the co-defendants, and he also cannot get a prescription for the drug oxycodone.

A courtroom filled with Foster's family, friends and coworkers showed up to see the deputy chief at his arraignment. He was the only defendant dressed in civilian clothes as he entered pleas of not guilty.

"They've been working on this case for a year. I have literally been working on it for two hours," said Marshall Hodgkins, Foster's attorney.

Even though Foster has no criminal record, he is facing more time in prison than each of the other co-defendants. Based on the charges, Foster is exposed to 45 years in prison and a fine of $2.25 million. Outside court, his attorney said the fact Foster will be free, will make it much easier to do his own independent investigation.

"It is extremely important in these circumstances to have a client out of custody who can talk to me, and that's what we will be able to do," said Hodgkins.

Hodgkins has represented police officers involved in criminal cases for three decades, but none as high ranking as Foster.

Legal analyst Jeff Hammerschmidt believes there are still a lot of details about the federal investigation that have not been released, including specifics about the pain killer prescription.

"I am sure if they haven't already done so that the feds will be looking at how long the prescription had been ongoing, who prescribed it, what the circumstances were, whether they were compliant with all federal and state laws in doing so," said Hammerschmidt.

For now, a judge decided Foster will not be allowed anymore prescriptions for oxycodone.

Jennifer Donabedian was the only other co-defendant released on Friday. The rest remain behind bars.

City leaders and Fresno Police Chief Jerry Dyer admit they should have seen the signs. The chief and Deputy Chief Keith Foster work feet away from each other at the Fresno Police Headquarters. The chief is now wondering how he missed what the FBI found.

Mayor Ashley Swearengin, city leaders and Chief Dyer briefed the media after meeting with the FBI. They asked the questions you, and we, all have. Should or could the police department have known what Foster is now accused of doing?

Mayor Swearengin said, "The response we received from the FBI was that the police department could not have known about these activities."

Yet they all feel as if they should have known about the criminal drug operation that Foster is accused of running.

City Manager Bruce Rudd tells Action News, "You start to internalize what you could have done differently, and as the mayor indicated based on our discussion with the FBI today, they do not believe there was anything we could have done to mitigate this or see it."

Rudd also says this investigation has not affected or changed his confidence in Dyer, who was and has been visibly affected when discussing the arrest of his close friend and second in command.

Dyer said, "But there is no relationship, there is no friendship that is worth compromising the integrity of a law enforcement organization; that is what I hold most dear to me."

The chief says Foster was not involved in any cases as his role was purely administrative. That means no investigations and no cases will be compromised. He did say he's pushing for an internal investigation. He's also asking that the investigation be completed within two weeks, which he hopes will bring back the confidence and trust that he knows is eroding.

"I vow as your police chief to do everything we can to regain whatever support, confidence and trust that we've lost as a result of this investigation," said Dyer.

The chief also says there's no indication that Foster was using drugs. He's only accused of distributing them.