(CNN) -- The JetBlue pilot who was locked out of his cockpit and tackled by passengers after an apparent in-flight meltdown seven months ago will be freed.
U.S. District Court Judge Mary Lou Robinson ruled Friday that Clayton Osbon should be released under the conditions that he continues mental health treatment as prescribed and does not try to get a pilot's license, get on a plane without the court's permission or communicate with anyone who was on his last flight.
Osbon was flying an A320 aircraft from New York to Las Vegas on March 27 when, according to court documents, he started acting erratic, telling air traffic control to be quiet and saying things such as "we're not going to Vegas" and "we're all going down."
When he left the cockpit, the co-pilot changed the door lock and directed passengers to tackle Osbon and restrain him until the plane made an emergency landing in Amarillo, Texas, where he was arrested.
Passengers captured some of the confrontation on cell phone cameras.
In July, Osbon was found not guilty by reason of insanity but was kept in custody for mental health treatment at a federal medical center in Fort Worth, Texas.
The next month, the court was notified that he had "suffered a psychotic episode" and requested that his time in the facility be extended.
In Robinson's order releasing Obson, she notes a new report from the U.S. Bureau of Prisons found that Osbon's release "would not create a substantial risk of bodily injury to another person or serious damage to the property of another, a finding to which neither the Government or the defendant objects."
The exact date of his release is not specified, but the Bureau of Prisons is ordered to free him after making arrangements including "mental health aftercare" and assigning him a probation officer.
More than two dozen passengers on the flight are suing JetBlue for negligence in allowing Osbon to fly. That civil case continues.