Amid a deepening scandal over accepting gifts, Philadelphia District Attorney Seth Williams announced Friday that he will not run for re-election.

The FBI and IRS have investigated Williams for taking $160,000 in gifts — including a $45,000 roof repair job, trips to Key West and Thailand, and two all-access Eagles tickets on the sidelines — that should have been disclosed in annual reports. Last month, he agreed to the largest-ever ethics settlement with the city — about $62,000. Earlier this week, he said he wouldn't resign.

"During my tenure, I have made regrettable mistakes in my personal life and my personal, financial life that cast an unnecessary shadow over the district attorney's office," Williams said. "My decision to accept gifts and fail to report them brought much embarrassment, shame and adverse publicity to me and unfortunately to the office for which I love.

"For this, I will always hold deep regret in my heart. My poor judgment caused distractions, which made the already difficult job of my assistants and critical staff even more challenging and raised doubts in the minds of some citizens regarding my character and my fitness to serve as your district attorney."

Williams made a name for himself for, in part, by prosecuting public officials who failed to disclose gifts, including taking up a sting operation that the Pennsylvania attorney general's office had chosen not to pursue.

Williams became teary-eyed as he spoke of his parents, his daughter, his ex-wife, and his path to the top job in the city district attorney's office.

"This decision I'm making, I believe, is in the best interest of this office and in the best interest of my family," Williams said.

He spent some time listing his accomplishments, such as a "focused deterrence" program to reduce gun violence, as one of the city's top law enforcers.

He took no questions after delivering his written speech.

Williams served as assistant district attorney and inspector general before he became district attorney in 2010. The city's first African-American district attorney, Williams served two terms and was running for a third in a race that already has drawn five challengers. 

Left in the Democratic primary are former prosecutor Joe Khan, former Municipal Court Judge Teresa Carr Deni, former Philadelphia Managing Director Rich Negrin, defense attorney Lawrence Krasner, and former prosecutor Michael Untermeyer. One Republican, attorney Beth Grossman, also is running.

Williams' announcement left some critics celebrating, including the Fraternal Order of Police Lodge 5, which recently paid for "help wanted" billboards and radio ads calling for Williams' ouster.

"There is a god! It’s a wonderful day!" FOP President John McNesby said. "We applaud him for stepping down."

The police union and Williams frequently clashed over charging decisions. In April, for example, McNesby accused Williams of refusing to "do his sworn job and prosecute attackers" when Williams declined to prosecute footballer LeSean McCoy for a bar brawl involving several off-duty cops.

Khan, one of Williams' Democratic challengers, agreed that Williams bowing out of the race was "the right thing."

This decision allows us to move on from the scandals plaguing the district attorney's office and gives the people of Philadelphia the opportunity they deserve to have a real discussion about the important issues facing the city, from reducing gun violence to addressing criminal justice reform," Khan said. “I will work with the mayor and police commissioner to ensure that unconstitutional stop-and-frisk policies become a thing of the past and that Philadelphia will remain a sanctuary city and a welcoming city where every resident is treated fairly.

"Now, more than ever, our city needs effective leadership in the DA’s office to keep our city safe and to protect our citizens from the overreaching of the Trump administration.” 

Challenger Negrin agreed: "I was among those who were optimistic when he took office, but those expectations were not met and his ethical and legal troubles have become a distraction to the office. The hard-working attorneys and staff deserve to be led by someone who puts a premium on criminal justice reform, integrity, innovation, and community service. I believe the Office of the District Attorney in Philadelphia should be a national model for progressive policies, professionalism and public safety."

WHYY staff writer Bobby Allyn contributed.