A San Francisco man was sentenced to six months in jail all because he ate a cookie without permission. Gregory Fields, 42, had been enrolled in a residential drug rehabilitation program at the Salvation Army Harbor Light Center since 2017 while he was on probation for a vandalism charge.

The intensive program involves a 30-day detox and a 30-day blackout period, in which people are not allowed to contact anybody in the outside world, including members of their family. Fields completed both phases of the program and continued to attend meetings at the Harbor Light Center.

Everything was going fine until he decided to eat a leftover cookie while the organization was making lunches for homeless people. When staff members at Harbor Light Center learned what he did, they asked him to leave the program.

Fields contacted his caseworker, and Harbor Lights agreed to let him return under one condition: He must restart the program, which includes the 30-day blackout period. Fields had no desire to go through that experience again and tried to find an alternative program to satisfy the terms of his probation.

He was unable to find a suitable program and was taken into custody. A judge told him that he could either spend six months in jail or return to Harbor Lights. Fields chose prison.

He would not have to spend much time behind bars. The following week, Drug Court Judge Michael Begert ordered Fields to be released on time served. He will remain on probation until 2021.

"The program's response was grossly disproportionate to the unauthorized snacking offense, and the court's response to the low-level rule violation is counterproductive and inhumane," Field's attorney, San Francisco Deputy Public Defender Dana Drusinksy, said in a statement

Photo: Getty Images