The suspected madman behind a deadly stabbing spree in Manhattan Monday has a long criminal history — and had just walked free from Rikers Island a month before the terrifying attacks, The Post has learned. Ramon Rivera, 51, identified by sources as the person of interest in the bloodbath, was released from jail Oct. 17 on a time-served sentence for a spate of recent burglary and assault convictions after spending most of this year behind bars, sources said.

The release perplexed Mayor Eric Adams, who said NYPD investigators were looking into how a career criminal with a history of mental illness could walk free, despite his recent convictions. “We are still looking over his record, but there’s a real question on why he was on the street,” he said. Court records show Rivera was arrested again the day of his release on a grand larceny charge after prosecutors said he stole a nearly $1,500 acrylic bowl from the luxurious Jonathan Adler shop in Tribeca in December 2023.

Manhattan prosecutors pushed for bail, and a judge ordered him released on non-monetary conditions ahead of a Dec. 4 court date, records show. Sources revealed Rivera has at least eight past arrests in New York City, a history of mental health issues and years of police run-ins crisscrossing several states.

Many details about Rivera’s record remained unclear as of Monday evening, but the broad strokes paint a portrait of a troubled, at-times violent man living outside the law for decades. Rivera’s lat.