Most people who've done time in jail can't wait to get away. But this week, New York City authorities accused one former inmate of sneaking back in.

Yonkers resident Matthew Matagrano, 36, was arraigned in Manhattan on Saturday on charges that he impersonated a Department of Correction investigator.

Officials say that for at least a week, Matagrano used phony credentials to get into multiple city lockups, including Rikers Island and the Manhattan Detention Center, where he mingled with inmates for hours.

Investigators said the case was still unfolding, but some of the allegations were detailed in a criminal complaint describing Matagrano's entry into the Manhattan jail on Thursday.

It said that when questioned, Matagrano had admitted to arriving at the jail at around 3:30 p.m. local time and gaining entry by showing a gold shield and saying he was an investigator from the department's intelligence unit.

According to the complaint, he stayed until 11 p.m., giving cigarettes to inmates and smoking with them in a common area. He is also charged with stealing a radio from an office while inside.

Surveillance cameras recorded video of Matagrano during the visit, the complaint said.

It wasn't clear if or when Matagrano would face similar charges for entry into other city jails. A spokesman for the Bronx district attorney, which often handles cases related to crimes committed on Rikers Island, said Saturday that he had no information on the case.

Matagrano has a rap sheet that includes a conviction for sodomy and sexual abuse. He's on the state's sex offender registry.

It's not clear why he wanted to get into jails, but he had previously been caught posing as a Board of Education worker to enter two schools and rifle through student files. In 2004, he pleaded guilty to attempted burglary in connection with that case.

His court-appointed lawyer, Andrej Bajuk, couldn't immediately be reached by phone for comment. No one responded to a message left at the public defender's office that handled his arraignment.

Department of Correction spokespeople did not immediately return phone messages Saturday.

A judge set bail at $50,000 for Matagrano. He also faces charges of burglary, possession of forged instruments, larceny and promoting prison contraband. He is due back in court Wednesday.