BANGOR — A 27-year-old Air Force veteran who claimed to have explosives aboard a trans-Atlantic flight suffered a brief psychotic break caused by a lack of sleep, dehydration and body-building substances and is not a threat to society, a federal judge ruled today.

The judge found Derek Stansberry of Riverview, Fla., not guilty by reason of insanity on charges stemming from his action aboard the April 2010 flight from Paris to Atlanta.

“It’s something that no one expected to happen (and) most importantly that no one expects will happen again,” Stansberry’s attorney, Walter McKee, said after the hearing in federal court in Bangor.

The Delta Airlines Airbus A330 landed in Bangor after Stansberry gave a note to a flight attendant and then responded “yes” when federal air marshals asked if he had explosives. At the time, the Florida man was returning home from the African nation of Burkina Faso, where he had been working for a defense contractor.

U.S. District Judge John Woodcock ruled that sleep deprivation, stress, dehydration and ingestion of body building supplements contributed to Stansberry’s psychotic break, which lasted several days.

Stansberry’s problems began when a flight attendant had trouble understanding him, so she asked him to write a note, according to court documents. Stansberry produced a rambling note filled with military jargon and acronyms in which he declared, among other things, that he was not a U.S. citizen, that his passport was a fake and that he’d illegally visited Burkina Faso.

The flight attendant alerted air marshals, who questioned him. Asked if he had explosives, Stansberry responded yes and described dynamite with a pressure switch in his bag. He later said there were explosives in his laptop computer as well.

Stansberry later told FBI agents on the ground that he made up the story to divert attention from classified information he claimed he possessed.

No explosives were found.