A bank robber dubbed the "Hat Bandit" because he wore different caps during the heists was sentenced Thursday to 10 years in federal prison.

James G. Madison, who eluded authorities during a 10-month crime spree, pleaded guilty in September to six bank robberies. He also acknowledged committing 12 others and attempting a 13th.

Sentencing guidelines recommended a 6 1/2- to eight-year term, but prosecutors wanted more time for the 50-year-old former machinist.

U.S. District Judge Jose L. Linares agreed, noting the "voluminous number" of bank robberies and that some included the threat of a gun, although no weapon was ever displayed.

Madison stood before the judge wearing a green prison jumpsuit and shackled at the wrists and ankles.

"I am deeply sorry for my actions and for the anxiety and stress I caused," he said. "I pray the court temper justice with mercy."

Madison eluded authorities from the fall of 2006 until late July 2007 despite being photographed several times on bank surveillance cameras. At various times he wore baseball caps, ski caps and a fisherman's hat, earning him the nicknames the "Hat Bandit" and the "Mad Hatter."

Madison, of Maplewood, began his spree about a month after he was released from a halfway house after serving nearly 20 years in prison for the bludgeoning death of a girlfriend, Terry Wells. Her body was found in a suitcase in the Passaic River.

The robberies netted Madison about $81,000. Linares ordered him to pay back that amount, but added that Madison did not have the means to do so now.

No one was injured during the robberies, which ended in July after a bank teller spotted the license plate on a getaway car. But Madison admitted that two of the notes he passed to tellers asserted he had a gun.