Seth Williams has until Friday to find a new lawyer to defend him against federal corruption and bribery charges. But after an at times combative hearing in federal court Tuesday, it's still not clear whether he can afford to pay for one.

U.S. Magistrate Judge Timothy R. Rice laid down that tight timeline for Philadelphia's cash-strapped district attorney and showed little sympathy for Williams' current lawyer, Michael Diamondstein, who has sought to leave the case after less than a week over concerns that his client cannot pay his legal bills.

"You made that decision [to sign on to the case] with open eyes and so did he," Rice admonished Diamondstein, as he ordered him to stand by Williams' side — at least for the moment. "It's a significant time in our city's history when the chief prosecutor is indicted by the federal government."

But the electric back-and-forth between the lawyer and the unyielding judge was all but overshadowed by the reception Williams received upon leaving the courthouse.

Black Lives Matter demonstrators quickly surrounded the district attorney, shouting within inches of his face: "Shame, shame, shame."

One attempted to follow him into a waiting car demanding to know why he had not yet resigned. That man was pushed back after a brief scuffle with a member of Williams' security detail.

The scenes, both in and out of court, encapsulated just how far Williams' fortunes have fallen and how much of the public support he once enjoyed has evaporated in the week since federal prosecutors unveiled their sprawling corruption case against him.

Williams stands accused of repeatedly selling his influence to two wealthy benefactors who showered him with gifts of luxury travel, free airfare, and designer clothes in exchange for favors from his office.

He has denied any wrongdoing and resisted calls from Mayor Kenney, the Philadelphia Bar Association, and others to resign.

But he stopped short Tuesday of directly answering the judge's repeated question of whether he was saying he couldn't afford his own lawyer, despite his $175,572 annual salary.

Williams has previously blamed his well-documented financial woes on debts stemming from a 2011 divorce and private-school tuition for his daughters.

But he assured the court that he was close to cementing a deal with someone else to represent him and was confident he could finalize that arrangement by Friday. He did not disclose whether he would be paying that lawyer or what plans he had if the deal fell through.

"I've spoken to many individuals, some that I cannot afford," Williams said. "But I've spoken to some individuals who I can afford."

For his part, Diamondstein said he never planned to see the case through to trial and described a hectic 24-hour period last week in the run-up to Williams' indictment.

A last-minute effort to resolve the case with a plea deal fell through. Prosecutors told Williams he would be indicted within a day. The city withdrew funding for the district attorney's legal defense. And the attorney who had represented him for much of the last year — John Pease III — stepped aside.

Diamondstein said he offered to represent Williams temporarily and see him through his initial court appearance last week as a favor but always planned to exit the case soon after.

That plan hit a snag late last week when U.S. District Judge Paul Diamond, who will oversee Williams' case, ordered Diamondstein to stay on, citing local court rules requiring lawyers to stick with their clients through a case's disposition once they are signed on.

Since then, Diamondstein said Tuesday, Williams has paid him "zero dollars and zero cents."

"And I can't close down my practice for a case with 300,000 emails and 80,000 documents for no money," he said.

But Rice, citing the highly publicized two-year investigation of Williams' finances by the FBI and IRS, questioned why he had not already lined up his own lawyer months ago, knowing his city-funded attorney would be leaving the case as soon as he was charged.

"How could it possibly be," he asked, "that this indictment could come as a complete surprise?"

Rice signaled Tuesday that Diamondstein would likely be released from the case if Williams showed up at a court hearing Friday with new representation.