Casey James Fury, 24, pleaded guilty last year to two counts of arson. U.S. District Judge George Singal in Portland imposed a sentence of 17 years and one month, followed by five years of supervised release.
Singal also said Fury should make payments to reimburse the U.S. Navy $400 million for the damage done to the USS Miami.
Fury admitted last year he set two fires in May and June because he wanted to leave work early during an anxiety attack.
"I cannot put into words how much remorse I feel," he said Friday, almost breaking down in tears several times. "It was a moment of extreme anxiety and panic, and I did not ever intend for that amount of damage to be done. To those who were injured in their heroic actions responding to the fire, I am most sorry."
The sentence was about two years more than Fury's lawyer suggested and two years less than the one requested by prosecutors.
The Miami was in the shipyard for repairs. The yard is in Kittery, Maine, across the Piscataqua River from Portsmouth, N.H.
Aaron Carter is still in love with Hilary Duff
NBC reportedly holds celebs hostage to Jimmy Fallon's show