(CNN) -- A JetBlue pilot charged with interfering with a flight after an apparent midair meltdown last week will undergo a psychiatric evaluation to see whether he is mentally competent to stand trial.
A federal judge on Wednesday ordered authorities to take pilot Clayton Osbon to a federal hospital for prisoners for testing to determine his competency and his "sanity or lack thereof at the time of the commission of the alleged offense."
The order could be the first step to divert the case from the criminal justice system to the health system.
The judge also postponed a court hearing scheduled for Thursday morning until Monday morning.
In a court filing, prosecutors said "there is reasonable cause to believe that (Osbon) may presently be suffering from a mental disease or defect rendering him mentally incompetent" to understand the case against him or to assist in his own defense.
U.S. District Court Judge Mary Lou Robinson ordered Osbon transferred to an unnamed medical facility for federal prisoners.
Osbon was charged with interfering with a flight crew following a March 28 incident on a JetBlue flight from New York to Las Vegas. The plane was diverted to Amarillo, Texas.
His remarks and erratic behavior on the planned five-hour flight led the co-pilot to lock Osbon out of the cockpit, according to a federal criminal complaint.
Crew and passengers subdued Osbon as he screamed and banged on the cockpit door so hard that the first officer thought Osbon would come through, the document said.
The flight data and cockpit voice recorders from the jet, which made an emergency landing in Amarillo last week, will be analyzed, officials have said.
CNN's Todd Sperry contributed to this report.