(Chip Somodevilla/Getty Images) Democratic presidential candidate Hillary Clinton's campaign says she will no longer accept contributions from private prison companies or groups that lobby for them.

WASHINGTON -- Democratic presidential candidate Hillary Clinton pledged Thursday to ban the use of private prison companies if elected president, and in the meantime will stop accepting campaign contributions from those corporations and the lobbyists who work for them.

All previous donations will be given to charity, the former secretary of state's campaign said.

"Hillary Clinton has said we must end the era of mass incarceration, and as president, she will end private prisons and private immigrant detention centers," campaign spokeswoman Xochitl Hinojosa said in a statement Thursday night. "She believes that we should not contract out this core responsibility of the federal government, and when we’re dealing with a mass incarceration crisis, we don’t need private industry incentives that may contribute -- or have the appearance of contributing -- to over-incarceration."

Hinojosa said the policy against accepting contributions tied to private prison companies "is only one of many ways that she believes we need to rebalance our criminal justice and immigration systems."

Lobbying firms that work for two major private prison giants, GEO Group and Corrections Corporation of America, gave $133,246 to the Ready for Hillary PAC, according to Vice. Those companies operate a number of criminal and immigrant detention facilities, some of which have been plagued by allegations of abuse and poor treatment of detainees.

Immigrant and civil rights groups have urged Clinton to stop accepting contributions from donors with ties to GEO and CCA. Earlier Thursday, in announcing its co-founder Cesar Vargas was moving to the campaign of Sen. Bernie Sanders (I-Vt.), the advocacy group Dream Action Coalition singled out Clinton for accepting those contributions.

Sanders recently introduced a bill to ban government contracts for private prisons, including immigrant detention centers.

Clinton said in May that immigrant detention shouldn't be based on profit concerns.

"People go out and round up people in order to get paid on a per-bed basis," she said. "That just makes no sense at all to me. That's not the way we should be running any detention facility."

Her campaign and PAC are not the only ones to take money with private prison connections. VICE reported that the PAC and campaign of Sen. Marco Rubio (R-Fla.) had received $133,450 from private prison companies and their lobbying groups, while former Florida Gov. Jeb Bush (R) and his PAC had received $21,700 from lobbying groups that work for GEO and CCA.