The San Francisco Public Defender's Office will ask the San Francisco Superior Court on Monday morning to release a man who is currently serving a six-month jail sentence for eating a leftover cookie without permission while undergoing a residential treatment program.

Gregory Fields, 42, of San Francisco, was caught eating the leftover cookie during an event where his residential treatment program - The Salvation Army Harbor Light Center - was making and handing out lunch to the homeless, the Public Defender's office said. The date of the occurrence wasn't provided.

After eating the cookie without asking, the public defender's office said Fields was asked by the program to leave. Fields worked with his caseworker to have Harbor Light let him stay, and they agreed, if he would start the program again.

According to the Public Defender's Office, starting it over would mean a 30-day detox and then a 30-day blackout period from the outside world.

The office claims Fields has been clean for three months.

Fields, who lives with his mother, declined to go back to the program during a Drug Court hearing last Monday and was remanded to the county jail by Judge Michael Begert on a six-month jail sentence. He has requested a new hearing, which takes place Monday morning.

"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 last week.

Fields was placed in the program while serving probation on a vandalism charge from 2017, the public defender's office said. After he was told to leave Harbor Light, Fields tried to visit the Drug Court for group meetings run by the city's Department of Public Health, but was turned away.

He eventually found another outpatient treatment program, but wasn't offered any other alternatives by Begert or his case workers when he was taken back into custody on Monday, Dec. 4, the Public Defender's Office said.

The Salvation Army didn't immediately respond to a request for comment early Monday.

Monday's hearing takes place at the San Francisco Superior Court's Drug Court, Third Floor, Courtroom 23, at 850 Bryant St., San Francisco.