HARRISBURG - After contending that his client was targeted in an anticorruption sting because she is African American, a defense lawyer dropped that allegation Wednesday and negotiated a plea deal for State Rep. Louise Williams Bishop in which she agreed to immediately resign from the legislature.

A. Charles Peruto Jr. said that after reviewing evidence assembled by the Philadelphia District Attorney's Office, he concluded that his charge of racial bias "has no viability."

He also said he had reviewed the likely testimony of five key witnesses, including the sting's undercover operative and two top aides to state Attorney General Kathleen G. Kane, and realized that "none of them were going to be able to back up my claim of racial targeting."

"I want to apologize to anyone who was offended" by his suggestion that race had been a factor in the investigation that led to Bishop's arrest, Peruto added.

Outside the courtroom, Peruto said he had gotten a great deal for his client. Unlike other defendants in the sting case, who pleaded guilty to felonies, Bishop, 82, pleaded no contest to a misdemeanor charge.

As with the other sting defendants, she lost her public office, but will keep her taxpayer-paid pension.

Bishop, a longtime radio personality who was elected to the House 13 times, had no comment as she left the Dauphin County Courthouse.

Peruto's retreat and the sudden deal short-circuited a drama in which Kane and her nemesis, former state prosecutor Frank Fina - the sting's architect - were literally waiting in the wings to testify in what would have been a public debate over Kane's charge that the sting's undercover operative had been ordered to target blacks.

Special Assistant District Attorney Mark Gilson, the lead prosecutor of the sting cases, provided plenty of drama anyway. In legal arguments in court, and in a thick package of evidence he made public afterward, Gilson said Kane's top advisers, including her current first deputy, had begged her not to play what they called "the trump card of race," but Kane spurned their advice.

In fact, Gilson said, his office obtained an email in which one of Kane's press assistants said her boss wanted the racial claim driven home to the news media - "shoved down their throats."

Chuck Ardo, Kane's spokesman, said she would not back down from her criticism of the sting. He said she had relied on statements from top aides who had told her they were concerned that the case had been marred by racial targeting.

"She stands by the information as was presented to her before those who gave her the information began recanting their comments," Ardo said.

In explaining her decision not to bring charges in the sting, Kane has said that the operation's informant, Tyron B. Ali, and its lead case agent, Claude Thomas, had told others they were instructed to focus on African Americans.

Thomas, who was prepared to take the stand Wednesday, has repeatedly denied saying that and has sued Kane for defamation. "She made it totally up," he said after the hearing.

Gilson said Wednesday that Ali, who is black, had told a grand jury that no one had ever ordered him to target blacks and that he would have refused such an order.

Gilson also disclosed that:

Days before The Inquirer broke the news in March 2014 that Kane had secretly shut down the sting investigation, her office explored turning it over to Philadelphia District Attorney Seth Williams for prosecution. Gilson made public a draft letter from Kane's office proposing the transfer - a letter that presented the sting as a solid case and made no mention of any racial concerns.

Former Kane aide David Tyler told the same grand jury that she should not have suggested that the investigation had been tainted by racial bias, telling her, "This racial thing should never have been in there." Tyler testified that Kane replied, "Yeah, you're right."

A current Kane aide, Kevin Wevodau, testified that he was worried she would fire him for giving "honest answers that did not support statements that she had previously made." He also said he did not believe that race played a role in the sting investigation.

Kane is awaiting trial in Montgomery County on charges of perjury, false swearing, official oppression, and other crimes. She has pleaded not guilty. Prosecutors say she leaked confidential information in a bid to embarrass Fina. They say her motive was revenge - that she believed Fina was the source for The Inquirer's story revealing her decision to shut down the sting.

Acting on a dare from Kane, Williams resurrected the investigation last year, assigning veteran homicide prosecutor Gilson to assess the audio and video recordings Ali made while working undercover from 2010 to 2012.

Before the hearing began Wednesday, Assistant District Attorney Brad Bender, who joined Gilson in prosecuting the undercover investigation, told reporters Kane's allies had attempted to give documents to Peruto to assist him in Bishop's defense.

"Are they other emails that she has and has refused to give to the public?" Bender asked. "I think she was actively trying to help criminal defendants in this matter. That is the chief law enforcement officer in Pennsylvania right now. That is the state of affairs. The public should be outraged and so should the legislature."

Peruto declined to address Bender's assertion. Ardo said he had no idea what Bender was talking about.

Gilson and Bender said Bishop had accepted a total of $1,500 from Ali, in three installments. After the last one, they said, Bishop exclaimed, "That's a biggie," not realizing that Ali was secretly recording their conversation.

She did not report receiving the money, setting the stage for her plea of failing to file an accurate financial-disclosure form as required by state law.

State Rep. Vanessa Lowery Brown, who prosecutors say pocketed $5,000 from Ali and did not report it on financial-disclosure forms, is the only defendant still awaiting trial. She had joined Bishop in raising a defense based on Kane's contention that the case was tainted by racial considerations.