A Brazilian court said Tuesday it had released the passports of two American pilots involved in a midair collision over the Amazon that killed 154 people.

The two pilots from New York state — Joseph Lepore, 42, of Bay Shore, and Jan Paladino, 34, Westhampton Beach — can pick up their passports and leave the country in 72 hours, the Federal Regional Court of the First Region of Brasilia said in an unanimous ruling.

The Americans were piloting a Brazilian-made Legacy executive jet when it collided Sept. 29 with a Gol Airlines Boeing 737-800 over the Amazon. All 154 people on board the Gol flight were killed, while the Legacy landed safely with all seven people aboard unharmed.

Shortly after the accident, authorities seized Lepore's and Paladino's passports, effectively barring them from leaving Brazil. They had since been holed up in a hotel in Rio de Janeiro's Copacabana beach.

Click here to go to FOXNews.com's Americas Center.

Brazilian prosecutors have said Lepore and Paladino could be charged with involuntary manslaughter if they are found responsible for the crash. The pilots have denied any wrongdoing.

Authorities had earlier said the passports would not be returned until an investigation into the crash is completed.

But federal judge Candido Ribeiro said Tuesday there were no legal grounds for restricting the pilots' movements.

However, the two must agree to return to Brazil for any further inquiry and judicial action, the court said.

Brazil is still investigating the crash, the worst in Brazilian history.

The Embraer Legacy jet was owned by ExcelAire of Ronkonkoma, N.Y., which did not immediately comment on the release.

"I heard the general terms of ruling but have no specific knowledge of it, so I'm not in position to comment on it at this time," said the company's attorney Robert Torricella, who has been Rio with the pilots since shortly after the crash. He said they expect to release a statement later and that pilots are not likely to talk to the media before leaving the country.

The Legacy was heading northwest on its maiden voyage from the southern city of Sao Jose dos Campos, to the United States when the accident occurred at an altitude of 37,000 feet — an altitude usually reserved for southbound flights.

Transcripts suggest the Legacy had been authorized by the tower in Sao Jose dos Campos to fly at 37,000 feet to Manaus, although that contradicted the plane's original flight plan.

Warning systems failed on both planes before they collided, an Air Force investigator said last month.

Air traffic controllers believed the Legacy was flying at 36,000 feet, a lower altitude, when it collided with Gol Airlines flight 1907, Brig. Gen. Luiz Carlos da Silva Bueno recently told a Senate committee.

"At departure air traffic control cleared the Legacy to Manaus at 37,000 feet," Torricella said at the time. "Absent a contrary clearance by air traffic control, the Legacy was required to remain at that altitude."

The two American pilots were interviewed and were "cooperative," Col. Rufino Antonio da Silva Ferreira said last month. He said the investigation could take 10 months to conclude.