A man who allegedly threatened to murder the manager and customers at several gay bars in Chicago was mistakenly released from jail.

Shane Sleeper, 31, was arrested in February for allegedly threatening to shoot up the popular gay club Sidetrack.

He reportedly said that 'Orlando will happen in Chicago', referring to the deadly massacre at the night club in 2016.

He was originally charged with misdemeanor crimes that prosecutors upgraded to felony charges on Monday.

However, a series of communication errors between the courthouse and the Cook County Jail resulted in Sleeper's release on Tuesday.

For two days he was on the loose in the same neighborhood he's been accused of threatening.

Shane Sleeper, 31, is facing felony charges in 13 cases involving alleged threats toward the gay community in Chicago, Illinois. On Tuesday he was mistakenly released from Cook County Jail

Sleeper had been in jail since February 21 when prosecutors dropped the misdemeanor charges against him on Monday.

They then filed felony charges in a total of 13 new cases alleging Sleeper had also threatened to shoot up another nearby bar and harassed a half-dozen people on different occasions dating back to 2016.

The charges include terrorism, hate crimes, stalking, impersonating a police officer and making death threats, among others.

On Tuesday morning officials at the Cook County Jail were notified that the misdemeanor charges were dropped but not that new ones had been filed.

Because of the confusion, Sleeper was released on Tuesday evening and was free until the Sheriff's Fugitive Task Force tracked him down and arrested him on Thursday morning.

Shane Sleeper, 31, was arrested in February for allegedly threatening to shoot up the popular gay club Sidetrack, pictured

The state attorney's office and sheriff's office have each blamed the mishap on the other.

'Preliminarily, it appears that the only cases he was being held on were dismissed and the sheriff's office was never notified of any additional charges that were brought,' sheriff's department spokesperson Cara Smith told the Chicago Tribune.

'We were never notified. Our phones are on 24 hours a day. We complied with the only court order we received.'

A spokesman for the state attorney's office Robert Foley said: 'Mr. Sleeper was in custody when the sheriff's office brought him to court yesterday.

'He was arraigned in a felony trial court room, where he was assigned a no bail status and left in the custody of the sheriff's office.'