(CNN) -- A JetBlue pilot who was locked out of the cockpit by his co-pilot after his odd midflight rants in March was ruled competent to stand trial Friday morning.
U.S. District Court Judge Mary Lou Robinson ruled that JetBlue Capt. Clayton Osbon is "mentally competent, that he is able to understand and does understand the nature and consequences of the proceedings against him, and that he is able to assist properly in his defense," according to a court order.
Osbon attorney Dean Roper plans on using an insanity defense, according to court documents filed April 18.
The pilot was indicted April 11, in a federal court in Amarillo, Texas, accused of interfering with a flight crew. The flight landed safely in Amarillo after the incident, according to the indictment filed that day.
Osbon is still employed by JetBlue "but is removed from active duty," JetBlue spokeswoman Allison Steinberg wrote in an e-mail. She declined to answer questions about the hearing: "We don't comment on pending litigation."
This week, a group of 10 passengers who were aboard the March 27 flight out of John F. Kennedy International Airport that was diverted because of Osbon's erratic behavior filed a lawsuit against the airline and pilot Wednesday in state Supreme Court in Queens.
The lawsuit, which was obtained by CNN, accuses JetBlue of being grossly negligent for allowing Osbon to fly and says the airline knew or should have known that Osbon was unfit to fly.
As the Airbus A320 was climbing out of New York's John F. Kennedy International Airport on its way to Las Vegas, Osbon talked about his church and needing to "focus," an FBI affidavit said. 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.
The lawsuit alleges that Osbon caused significant distress to the passengers, specifically by yelling obscenities and things such as "Say your prayers," "We're all going down," "I'm going to show you Iraq and Iran right now" and "There's a bomb on board."
The concerned co-pilot suggested that 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 lock, the co-pilot announced an order to restrain him over the public address system. Several passengers wrestled Osbon to the floor.
The flight was diverted to Amarillo, and Osbon was taken into custody.
CNN's Katia Hetter, Aaron Cooper, Dan Verello, Dave Alsup and Mike Ahlers contributed to this report.