HARRISBURG, Pa. (Reuters) - Former Philadelphia District Attorney R. Seth Williams was sentenced on Tuesday to five years in federal prison for taking bribes and committing fraud to maintain a lifestyle prosecutors said he could not afford.

FILE PHOTO: Philadelphia District Attorney R. Seth Williams speaks during a news conference at the district attorneys office in Philadelphia, Pennsylvania, May 15, 2013. REUTERS/Tim Shaffer/File Photo

Williams, 50, the first African-American elected as district attorney in Pennsylvania, had gone on trial before Judge Paul Diamond in June but entered a guilty plea to one count of bribery and resigned before the trial concluded in U.S. District Court in Philadelphia.

The two-term Democrat had been in office since 2010.

“Mr. Williams, you sold yourself to the parasites you surrounded yourself with,” Diamond said at the sentencing, WHYY Radio reported on Twitter. “You harmed all of the citizens of this city.”

Williams, in a letter read in court by his attorney, Thomas Burke, said he made “mistakes” and acknowledged the hurt he caused his family and the black community, WHYY tweeted.

Between July 2010 and May 2015, prosecutors said, Williams accepted trips to the Dominican Republic for himself and his girlfriend, as well as money and luxury personal items, from Philadelphia-area businessman Mohammad Ali.

In return, prosecutors said, Williams took steps including “contacting a Philadelphia police official in order to pressure and advise the official to assist Ali with security screenings at the airport.”

Ali pleaded guilty in May to bribery and tax evasion.

In an Oct. 16 sentencing memorandum, prosecutors said that Williams, despite gross annual income topping $200,000, “chose a lifestyle he could not afford.” He faced significant expenses for two mortgages on an expensive home, private-school tuition for his daughters, and alimony to an ex-wife.

“There are legal ways to deal with such circumstances,” prosecutors wrote. “Williams consistently chose the unlawful route, taking whatever opportunity came his way to take more money and other valuable items, both by selling his office and committing fraud.”

Williams was disbarred by the Pennsylvania Supreme Court on Oct. 19.