(CNN) -- A JetBlue pilot who had an apparent meltdown aboard a flight last week will undergo a psychiatric evaluation to see whether he was sane during the incident and whether he is competent to stand trial.
In what could be a first step to divert the case from the criminal justice system to the health system, a federal judge Wednesday ordered that pilot Clayton Osbon be taken to a hospital for the examination.
There is reason to believe Osbon "may presently be suffering from a mental disease or defect rendering him mentally incompetent" to understand the case against him and assist in his defense, the U.S. Attorney's Office said in a Texas court filing.
U.S. District Court Judge Mary Lou Robinson ordered Osbon transferred to a medical facility for federal prisoners, which was not named. Robinson also postponed a court hearing scheduled for Thursday morning in Amarillo until next Monday.
Osbon, 49, was charged with interfering with a flight crew following a March 28 incident on a JetBlue flight from New York to Las Vegas. Early in that flight, the plane's copilot became concerned about Osbon's bizarre behavior, according to an FBI affidavit.
As the Airbus A-320 was climbing out of New York's Kennedy International Airport, Osbon talked about his church and needing to "focus," the affidavit says. He then told the copilot to take the controls and to work the radio, and began talking about religion, making statements that were incoherent, it says.
The copilot became further concerned when Osbon said "things just don't matter" and when he yelled over the radio to air traffic controllers.
At one point, Osbon said, "We're not going to Vegas," according to the affidavit.
Concerned by Osbon's erratic behavior, the copilot 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 copilot used the opportunity to get the off-duty captain into the cockpit and lock the door.
When Osbon tried to enter his code into the cockpit door, the copilot 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, where it landed safely.
CNN's Todd Sperry contributed to this report.