An alleged murderer who tried to jump from a 12th-floor apartment to escape the cops was caught when his underwear got snagged on the window handle.

Boston police said Michael Perry, 37, was charged with murder Friday after he tried to flee an apartment with a corpse found in it earlier this week, only to end up hanging upside down a dozen floors above the street.

Authorities identified the dead man as 43-year-old Jose Aponte, and said that it was Aponte’s Roxbury apartment that Perry tried to jump from.

Police discovered the body during a well-being check Sunday night, after someone texted Aponte’s boss calling in sick, but in a style that did not match Aponte’s usual writing, NBC Boston reported.

“When police got there, they found the resident of the apartment deceased in the apartment with significant signs of physical trauma,” prosecutors said during Perry’s arraignment. “Mr. Perry was farther back in the apartment. He had moved things to obscure himself. They called out to him, asked him if he had any weapons, and his response was ‘Come and find out.’”

A SWAT team responded to the scene and Perry tried to escape by jumping out the window, but instead he ended up dangling precariously by his underwear.

Police propped open the window to hold his legs while other officers went down to the 11th floor, where they pulled Perry through a window below.

He has since been charged with assault with a dangerous weapon in connection with his clash with police and murder for the death of Aponte.

It was reportedly not the first time Perry found himself in such a situation.

In 2017, he was reportedly arrested by a SWAT team after he attacked another man in a Boston hotel, then tried escape police by jumping from a window onto an awning below.

Authorities have not yet commented on Aponte’s cause of death or what Perry’s relationship with his alleged victim was.