Story highlights The fire started aboard the USS Miami while the sub was in dry-dock

It took firefighters 12 hours to extinguish, and caused some $400 million in damage

Shipyard worker Casey James Fury admitted to two counts of arson

He could have faced life in prison

A shipyard worker who pleaded guilty to arson in a fire that did at least $400 million in damage to a U.S. nuclear attack submarine has been sentenced to over 17 years in federal prison and ordered to pay $400 million in restitution, federal prosecutors said Friday.

Casey James Fury admitted to two counts of arson in November in connection with the blaze aboard the USS Miami last May 23 and a smaller fire beneath the dry-docked submarine in June, according to court papers. The 25-year-old civilian painter and sandblaster at the Portsmouth Naval Shipyard in Maine told investigators that he started the fires because he was having extreme anxiety and was trying to get out of work, the documents state.

Fury could have faced life in prison on the charge. But the judge weighed the severe damage caused by the fire and the risk to life that it brought against the fact Fury had never been in criminal trouble before and suffered from anxiety and depression, according to CNN affiliate WGME

Fury was accused of setting fire to a plastic bag full of cotton rags in a cabin in the forward end of the Miami, starting a conflagration that took the ship's crew and firefighters from the shipyard and nearby towns 12 hours to put out. Five firefighters and two sailors were injured during the effort.

The fire damaged crew quarters and command-and-control spaces aboard the submarine, the Navy said at the time. The damage was forward of the nuclear reactor that powers the vessel, which had been shut down and was closed off after the fire began, the service reported.

"Today's sentencing hearing of Mr. Fury closes one chapter on last year's historical and tragic experience that impacted our submarine force, disrupted the lives of countless officers, sailors who serve our Navy as well as the maintenance and operational schedule of the entire submarine force," said U.S. Navy Rear Adm. Richard Breckenridge at a press conference Friday.

The 362-foot Miami was commissioned in 1990 and had been undergoing an extensive overhaul at the Portsmouth shipyard. The Navy says it plans to repair the submarine and return it to service.