Birmingham police officers were left red faced when a suspect locked an inspector in a room before jumping 30 feet out of a window.
Miraculously, Julian Barnes survived his leap without a scratch, the city's crown court heard.
In jailing Barnes for 15 months, Mr Recorder Melbourne Inman QC said: "You made a determined attempt to escape. How on earth you managed to avoid injuring yourself is beyond belief."
Barnes (30), of Wyndhurst Road, Stechford, admitted charges of escape, possessing a baseball bat, assault, and possessing cannabis.
Sally Hancox, prosecuting, said Barnes, who was held in connection with firearms charges, was taken to Bridge Street West police station for an identity procedure. He grabbed the keys that were hanging near the door and locked an inspector and his own solicitor inside.
The alarm was raised when the inspector banged on the door and an officer discovered Barnes trying to jump out of a window.
The officer tried to grab him and, despite a warning that he would probably kill himself, Barnes jumped.
Miss Hancox said he landed in a yard and climbed on to another building before jumping over the fence.
Four days later police called to fracas saw Barnes wielding a baseball bat and caught him. Gurdeep Garcha, defending, said the escape was a spontaneous decision and Barnes had put his own health at risk for something he was not ultimately charged with.