He could have been out of the prison for the price of a candy bar.
A man from Queens, New York, spent nearly 5 months inside Rikers Island prison without knowing his bail was just a measly $2.
Read: Seven Innocent People Volunteer to Serve 60 Days in Prison to Show Real Life Behind Bars
Aitabdel Salem, 41, was locked up between November 2014 and April 2015.
Last week, he was acquitted of skipping his bail of $25,000 for attacking an NYPD officer who arrested him in November for allegedly stealing a coat from a department store.
Unbeknownst to Salem, prosecutors could not get an indictment against him and he was ordered to be released soon after his arrest. However, he was locked away inside Rikers because he had two $1 bails on his record due to minor offenses which included tampering and mischief charges.
Salem could not be freed without paying them first. According to his current lawyers, he had no idea the minor bail was on his record.
Read: Man Calls 911 to Complain He's 'Too High,' Officers Find Him Surrounded by Junk Food
The Algerian native blames his previous attorney for failing to inform him about the change in his bail status, according to the New York Daily News.
Salem's new lawyers argued to a New York judge that he could not be blamed for something he did not know and was acquitted of bail jumping.
Watch: Diane Sawyer Gets Unprecedented Access to 'Hell' - Rikers Island Prison