Rhode Island Prison Escapee Captured in Massachusetts

James Morales, 35, escaped from a Rhode Island prison on New Year's Eve.

— -- An inmate who was on the run for days after escaping from a federal prison in Rhode Island was captured near Boston this afternoon, after he allegedly tried to rob two banks in the area, the Massachusetts State Police said.

James Morales' capture in Somerville, Massachusetts, this afternoon came after he allegedly tried to rob a bank in Somerville and another bank in nearby Cambridge, Massachusetts, today.

Morales was caught after he led authorities on a two-block foot chase, state police said.

Morales, 35, had escaped from the Donald W. Wyatt Detention Facility in Central Falls, Rhode Island, on New Year's Eve, authorities said.

Morales -- a former Army reservist -- was in federal custody for the "theft of numerous firearms from the Worcester Army Reserve Armory in 2015," Massachusetts State Police said. He was also wanted "for an alleged violent and brutal sexual assault of a child," police said.

This morning, Morales allegedly tried to rob a bank on Massachusetts Avenue in Cambridge, which is about 50 miles northeast of the prison, law enforcement sources told ABC News.

Police said he passed a note to the teller demanding money shortly before 10 a.m. The suspect did not get any money, police said.

"We do not have an identity of the suspect at this point in time," Cambridge police said at the time, but "investigators are looking at the possibility that the suspect generally fits the description" of Morales.

Officials said Morales broke out of the prison on New Year's Eve by climbing a basketball hoop to reach a rooftop, cutting through a fence and then climbing through razor wire.

Jamie Hainsworth, a U.S. marshal for the district of Rhode Island, said earlier this week Morales "has the potential to be dangerous and could be armed."

Hainsworth also said officials will take a "hard look" at the procedures of the Wyatt prison and investigate whether the community of Central Falls was appropriately notified of the escape. Morales was discovered to be missing by prison staff at 10 p.m. on Dec. 31 -- about three hours after he escaped, according to Hainsworth.

ABC News' Avianne Tan contributed to this report.