Maria Rivera sold her home and went bankrupt in recent years trying to pay the $16,372 she owed Orange County for incarcerating her then-teenage son in Juvenile Hall.

Yet, even after her bankruptcy, the county – which state law permits to charge parents for locking up their kids – persisted in pursuing Rivera for the rest of what she owed.

Now, she is relieved of that burden.

Last week, the Orange County Probation Department was scolded by a federal appeals court for continuing to pursue the debt after Rivera’s bankruptcy, calling the county’s tenacity “disturbing” and ruling that it could not continue to go after Rivera for her debt.

“Rivera’s case is troubling … because the County’s actions compromise the goals of juvenile correction and the best interests of the child, and, ironically, impair the ability of his mother to provide him with future support,” Judge Stephen Reinhardt of the 9th U.S. Circuit Court of Appeals wrote in an Aug. 10 ruling.

Reinhardt was part of a three-judge appeals court panel that heard the case and issued the ruling.

“Seeking to obtain that revenue by unremittingly pursuing legal actions against disadvantaged individuals – the counterproductive practice at issue here – can have damaging effects on the community,” he wrote.

Rivera’s troubles began between 2008 and 2010 when her son spent more than a year in juvenile detention for an unnamed crime, according to court documents. Orange County sought to recover $23.90 from Rivera for each day her son was detained and $2,200 for legal expenses.

She paid $9,508 to the county in May 2010 after selling her house, but it wasn’t enough. The county increased the remaining amount she owed from $6,864 to $9,905 – a change Reinhardt called “highly questionable.” County counsel couldn’t explain that discrepancy, according to court documents.

By September 2011, Rivera filed for bankruptcy and by January 2012 she received a “fresh start” from her debts.

But instead of backing off, the probation department continued to pursue Rivera – saying it supported her son and citing a law created to ensure people couldn’t escape alimony and child-support payments via bankruptcy.

“All they wanted was the money, and every time they called me they would say, ‘If you don’t pay, we’re going to take you to court or your driver’s license is going to get suspended,’” Rivera said in an interview. “I was scared.”

In response, Rivera reopened her bankruptcy case and asked the court to sanction the county for its actions. A bankruptcy judge ruled in the county’s favor, citing a law that allowed government agencies to collect debts for providing “family support,” even after bankruptcy.

The appeals court overturned that ruling.

“Rivera’s son was taken into custody not in order to provide a place where he could secure a wholesome upbringing but because of his criminal misbehavior,” Reinhardt wrote.

Orange County Probation Department spokeswoman Jennifer Palmquist said the county will not appeal the ruling and will review its policies of how it pursues debts resulting from juvenile incarceration.

“I think it will have an impact on only a very narrow amount of cases where the family does declare bankruptcy,” Palmquist said.

Reinhardt noted that while the law allows counties to seek reimbursement for the cost of incarcerating juveniles, it does not require them to do so. The Orange County Probation Department gets 43 percent of its operating budget from self-generated revenue.

Orange County’s charge of $23.90 per day in juvenile lockup is moderate compared to others statewide. San Diego County charges $30 a day, while Los Angeles County charges nothing, according to a recent state legislation analysis.