An inmate who made a daring escape from a maximum security facility in Rhode Island on New Year's Eve, and then wandered through Massachusetts before getting captured days later in Somerville, appeared in court Friday.

James Morales, who was arrested Thursday, appeared in federal court in Providence, Rhode Island. He waive his right a preliminary hearing and was ordered held in federal custody, WBZ reports. Officials did not say exactly where he will be detained.

The 35-year-old escaped after he climbed a basketball hoop in the prison's recreation area, cut through a fence and shimmied down the building, officials said.

Video surveillancefootage showed him escaping around 7 p.m., but correctional officers didn't become aware he was gone for several hours, officials said.

During his five days on the run, authorities said Morales made his way to Massachusetts, stole a car and attempted to rob two banks, one in Cambridge and the other in Somerville. That Somerville attempt led to his arrest, officials said.

U.S. Marshals said Morales will not be returned to the Wyatt facility, according to WBZ.

The Wyatt facility underwent a $47 million expansion that was completed in late 2006, according to its website. The facility houses up to 730 male detainees and 40 female detainees. It is operated by the Central Falls Detention Facility Corporation, a quasi-public corporation, according to its website.

After Morales's escape, it was revealed that correctional officers there were working mandatory overtime hours, with some officers logging up to 80 hours a week, according to the Associated Press.

In October, the facility had 98 correctional officers, according to board meeting minutes, well below the 140 officers that is considered a full staff.