(CNN) -- Clayton Osbon, the JetBlue pilot who was restrained by passengers after he left the cockpit and acted erratically during a flight last month, will use an insanity defense, according to court documents filed Wednesday by his attorney Dean Roper.
CNN contacted Roper's office, but was told the attorney was unavailable and would not be commenting.
Osbon was ordered to be transferred to a mental hospital to undergo a psychiatric examination two weeks ago. A hearing set at the time was postponed pending that evaluation.
He is charged with trying to "knowingly and willingly interfere and attempt to interfere with the performance of the duties of a flight crew member and flight attendant."
The case is being handled by a federal court in Amarillo, Texas.
According to an FBI affidavit, a JetBlue co-pilot became concerned about Osbon's bizarre behavior early in their March 27 flight from New York to Las Vegas.
As the Airbus A320 was climbing out of New York's John F. Kennedy International Airport, Osbon talked about his church and needing to "focus," the affidavit says. He then told the co-pilot to take the controls and to work the radio, and began talking about religion, making statements that were incoherent, it says.
At one point, Osbon said, "We're not going to Vegas," according to the affidavit.
The concerned co-pilot suggested they invite an off-duty JetBlue captain into the cockpit. Instead, Osbon "abruptly left the cockpit to go to the forward lavatory," the affidavit says.
The co-pilot used the opportunity to get the off-duty captain into the cockpit and change the combination to the door lock.
When Osbon tried to enter his code into the cockpit door, the co-pilot announced over the public address system an order to restrain Osbon. Several passengers wrestled Osbon to the floor and restrained him.
The flight was diverted to Amarillo, after which Osbon was taken into custody.