The two U.S. pilots who have been held in Rio de Janeiro since a fatal midair collision in September will be allowed to go home, a Brazilian court said on Tuesday. The pilots -- Joseph Lepore and Jan Paladino, both of New York -- will have their passports returned to them and can leave the country in 72 hours, after being further debriefed by police, the court said. The two must agree to return to Brazil for any further inquiry and judicial action. "Restricting the freedom of movement for foreigners is not backed by the domestic legal system," the court's statement said, according to Reuters. Brazil is still investigating the crash, which was the worst in the country's history. The pilots were flying an Embraer Legacy jet above the Amazon on Sept. 29 when it collided with a Gol Airlines Boeing 737-800. All 154 people on board the 737 were killed. The Legacy made a safe emergency landing with all seven people aboard unharmed. Public opinion in Brazil seems to be shifting away from blaming the pilots to focus on concerns with air traffic control, Reuters said.