Casey James Fury also was ordered to pay $400 million in restitution.
The judge imposed the 205-month sentence under a plea agreement.
The 25-year-old Fury, formerly of Portsmouth, N.H., pleaded guilty to setting the May 23 fire while the submarine was undergoing a 20-month dry dock overhaul at Portsmouth Naval Shipyard in Kittery.
The civilian painter and sand blaster told authorities that he needed to go home because he was suffering from an anxiety attack and had no more vacation or sick leave. He said he never envisioned such extensive damage when he used a lighter to set fire to a plastic bag of rags that he left on a bunk in a state room.
The blaze quickly grew into an inferno spewing superheated smoke that billowed from hatches. It took 12 hours for more than 100 firefighters to save the submarine.
Seven people were hurt, the Navy has said.
Eric Hardy, a shipyard firefighter who suffered back and shoulder injuries fighting the blaze, called it the worst fire he had ever seen.
“The best way I could describe it, sir, is fighting a fire in a wood stove and climbing down a chimney,” Hardy told the judge.
Fury, who had been working in the torpedo room, fled to the safety of the pier and watched as firefighters went down hatches and into the burning Los Angeles class-attack submarine, staying inside for only minutes at a time because of the blistering heat.
Hardy said the smoke inside the sub was so thick he couldn’t see more than a foot and his flashlight was virtually useless. Firefighters had 20-minute air packs, but it was so hard to get aboard sub and move around inside that they were limited to two to three minutes of actual firefighting.
About three weeks later, Fury set a second fire outside the crippled sub, again because he wanted to go home because of anxiety. That fire caused little damage. He pleaded guilty to two counts of arson in November.
Prosecutors said it was telling that he tried to set a second fire after the extensive damage caused by the first one.
But the defense contends Fury suffered from depression and anxiety and that he never intended to harm anyone.
Fury spoke briefly Friday, apologizing to the people who were hurt and saying he meant no disrespect to the Navy.
“From the bottom of my heart, I’m truly sorry for what I have done,” he said.
The first blaze damaged forward compartments including living quarters, a command and control center and the torpedo room. It did not reach the rear of the submarine, where the nuclear propulsion components are located.
The fire’s intensity raised concerns about the integrity of the hull, which must withstand intense pressure at extreme underwater depths. Metallurgists who examined the hull found no major damage and the Navy determined it was cost-effective to repair the vessel with a goal of returning it to service in the middle of 2015.
But its future is now uncertain. Repairs have been postponed under mandatory budget cuts known as sequestration.
Rear Adm. Richard Breckenridge, a submarine group commander, said the ship’s extensive damage had ripple effects around the Navy, delaying repairs on other vessels and leading to longer deployments for thousands of sailors.