A man turned prison security on its head by breaking into two maximum security jails.

Sex offender Matthew Matagrano broke into Rikers Island, the biggest detention facility in New York City. He also allegedly broke into Manhattan Detention Centre, which is usually described as being like a "fortress."

In another twist, police claim that Matagrano committed theft while inside the jails. Officers say he was captured on CCTV stealing a walkie-talkie from an office in the Manhattan jail.

To get back into prison, Matagrano equipped himself with a gold badge and false papers to trick staff.

After duping guards, the 36-year-old allegedly spent almost eight hours wandering around the jail, mingling with some of the inmates and sharing cigarettes with them.

An official at Rikers Island told Village Voice: "He was able to go to the main security trailer on several days, show his ID, and drive his car across the bridge.

Staff cuts blamed

"He could have brought an arsenal on to the island. Anything could have been in the trunk of his car."

The Correction Officers Union blamed the incident on staff cuts. President Norman Seabrook said: "If nothing else does, this sends a signal to the mayor of New York that there's a major problem here.

"This is scary. We don't know what he left behind in those jails, we don't know what he brought in.

"A lot of it has to do with post cuts and shift reduction and a commissioner of the agency who is not concerned with security. Someone is going to get seriously hurt."

New York City resident Matagrano, served time in jail for sexual abuse and sodomy in 1996. The offence included the rape of a 17-year-old boy.

He was back behind bars in 2004 after disguising himself as an education official and breaking into a school to rummage through students' files.

After the latest deception, Matagrano was released on $50,000 ahead of his trial for burglary, possession of forged instruments, larceny and also promoting prison contraband.