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, 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.

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.