PORTLAND, Maine — A civilian employee at the Portsmouth Naval Shipyard in Kittery accused of intentionally setting a fire on May 23 that caused $400 million in damage to the nuclear attack submarine USS Miami was in U.S. District Court on Monday for an initial appearance.

Casey James Fury, 24, faces two arson charges brought by investigators with the Naval Criminal Investigative Service. In addition to the May fire, Fury also has been charged with starting a second fire, which was extinguished quickly, on the evening of June 16.

The New Hampshire man was arrested Friday evening at the Kittery shipyard. U.S. Attorney Thomas Delahanty II said Monday he didn’t know whether Fury was working at the time of his arrest.

Fury faces up to life in prison and as much as $250,000 in fines on each charge if convicted.

Wearing an orange jumpsuit, Fury arrived in court Monday shackled at the ankles with his hands cuffed behind his back. A thin man of medium height with close-cropped hair, Fury remained silent except to speak quietly with his attorney and answer questions from U.S. Magistrate Judge John H. Rich III.

Fury is being represented by court-appointed attorney David Beneman of Portland.

A combined probable cause and detention hearing has been scheduled for Aug. 1 in U.S. District Court.

The fire on the USS Miami began on the afternoon of May 23 and was extinguished early in the morning May 24 after burning for 12 hours. Fury initially denied involvement with the May fire but later confessed after failing a voluntary polygraph test, according to an affidavit filed by NCIS.

Fury also allegedly admitted during a June interview with investigators to lighting the second fire, according to the affidavit.

Fury told investigators he was stripping paint in the torpedo room of the submarine on the afternoon of May 23 when he said he had left his post because of bad anxiety. The affidavit describes a confession by Fury in which he said he had left the paint stripping work, walked to a stateroom in the middle level of the vessel and set a bundle of rags on fire on a bunk bed.

The affidavit states Fury then returned to his work until a co-worker notified him a fire alarm was going off.

More than 100 firefighters converged May 23 to fight the blaze on the USS Miami, which spread throughout the front sections of the vessel. The submarine was not armed at the time, officials said.

Seven people were injured in the fire.

The June 16 fire began in the dry-dock area underneath the nuclear submarine, approximately where Fury was working the day of the fire. Fury allegedly told investigators he had set a pack of isopropyl alcohol wipes on fire and placed them under some plywood in the dry dock because he had wanted to leave work after a text message exchange with an ex-girlfriend made him upset.

John Cunningham, a civilian refrigeration mechanic in the shipyard who reported the June 16 incident, told investigators alcohol wipes appeared to have been used to start that fire, according to the affidavit.

With at least $400 million in damage to the USS Miami, a Los Angeles-class attack submarine commissioned in 1990 and built at a cost of $900 million, debate arose after the fire as to whether to put more money into fixing the vessel. The U.S. Navy is in the process of assessing whether to repair the submarine.

Fury told investigators at the time of the fire that he was suffering from anxiety and depression and was taking several medications for combating those conditions as well as his insomnia. Fury checked into an inpatient mental health facility on June 21 and checked out on June 23. The affidavit did not specify the facility nor where it was.

U.S. Rep. Chellie Pingree said Monday the arson was an “isolated incident” and encouraged punishment for anyone convicted of damaging the submarine.

“This is not a reflection on the incredible character and commitment of the workers of the Portland Naval Shipyard,” Pingree said in a press release. “I hope we can find justice to punish actions that needlessly put lives at stake, and would have led to an even more serious disaster and loss of life if not for the courageous, quick reaction of those at the shipyard.”