SEATTLE (AP) — A Florida man who fought with flight attendants and passengers when he tried to open the exit door of a Delta Air Lines flight bound from Seattle to China has been ordered released from federal custody by a Seattle judge.

Joseph Daniel Hudek IV asked the court last month to reconsider detaining him after his July 6 arrest, The Seattle Times reported Tuesday (https://goo.gl/NpY1wg).

Hudek, 23, says in new court documents that he had ingested edible marijuana before the flight and insists he poses no danger if he's not high.

"Later, while on the airplane and after I had consumed the marijuana, I began to feel dramatically different," Hudek said in an affidavit. It doesn't say how much of the marijuana he consumed.

His Seattle lawyer, Robert Flennaugh II, said in a related motion that Hudek can live with his parents in Tampa, Florida, or an uncle in Texas, will have a job and will refrain from alcohol and marijuana.

Although the government objected, Magistrate Judge James Donohue released Hudek on Tuesday to his mother so he can return home to Tampa. Hudek must travel by train or car, however, and he is barred from using cannabis.

The July flight bound for Beijing was over the Pacific Ocean when an agitated Hudek walked out of the first-class restroom and tried to open the exit door, federal prosecutors said.

Two flight attendants tried to stop Hudek, and he threw one to the floor and punched the other, according to prosecutors.

When a passenger attempted to help the attendants, prosecutors say, Hudek hit the man over the head with a wine bottle.

As passengers struggled with Hudek, who was throwing punches, a flight attendant "grabbed two wine bottles and struck Hudek over the head with each, breaking at least one," according to the criminal complaint filed July 7.

Several passengers intervened and held him down while he was restrained with zip ties.

Hudek was indicted on one count of interfering with the flight crew and four counts of assault on an aircraft in the incident. He faces 20 years to life for assault and up to 10 years for other criminal counts.

His trial is set for February.