HOUSTON _ A federal judge in Texas has ordered the JetBlue Airways pilot accused of disrupting a Las Vegas-bound New York flight with rants about religion and terrorists to undergo a psychiatric exam.

The order signed by U.S. District Judge Mary Lou Robinson in Amarillo on Wednesday will send pilot Clayton Osbon to an unidentified medical facility for federal prisoners. There, he will undergo tests to determine if he was legally sane on March 27 when passengers subdued him after he allegedly sprinted through the plane shouting about Jesus and al-Qaida.

The exam also will determine if Osbon, 49, is competent to stand trial, court staff told the Los Angeles Times.

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 motion filed Wednesday, the same day Osbon's attorney asked another judge to reschedule a Thursday detention hearing. A spokeswoman for the prosecutor's office did not return calls Thursday.

The hearing is now scheduled for Monday in Amarillo, court staff told the Times. Osbon has been charged with interfering with a flight crew.

During the flight, the co-pilot became concerned about Osbon's bizarre behavior, according to an FBI affidavit. As the Airbus A-320 departed New York's John F. Kennedy International Airport, Osbon _ who had worked for JetBlue for 12 years _ began talking about his church and needing to "focus." Then he reportedly told the co-pilot to take the controls and work the radio. He then began ranting incoherently about religion, saying "things just don't matter," and he eventually yelled over the radio at air traffic controllers, the affidavit said.

Concerned, the co-pilot suggested that an off-duty JetBlue captain join them in the cockpit, and Osbon "abruptly left the cockpit to go to the forward lavatory," according to the FBI affidavit.

While he was gone, the co-pilot ushered the off-duty captain into the cockpit, locked the door and when Osbon returned, the co-pilot used the public address system to ask passengers to restrain the erratic pilot and they obliged, according to the affidavit.

The flight was diverted to Amarillo, where it landed safely. Osbon was taken into custody by the FBI and held at a medical facility.