A Staten Island, N.Y., robbery suspect escaped from custody Wednesday by pretending to be another prisoner, the New York Post reported Thursday.

Freddie Thompson, 35, was charged in connection with five robberies Tuesday and was set to be arraigned Wednesday, cops said.

But before his case was called, he switched places with a marijuana suspect.

A correction officer called the drug suspect out of his cell and Thompson followed him, a law enforcement source said.

He then pleaded guilty to the other suspect's marijuana charge and was sentenced to time served.

Thompson, who police said served time for an assault and a parole violation, walked out of the Staten Island criminal courthouse and authorities did not realize the mistake for another 90 minutes.

A spokesman said the department was looking into the incident.

Click here to read more from the New York Post.