A Florida man was released from jail Tuesday as he awaits a February trial for assaulting a flight crew and passengers and attempting to leave the plane mid-flight. The incident happened in July.

Joseph Hudek IV was on a Delta flight from Seattle to Beijing when he allegedly he tried to open a door and attacked people trying to control him, according to the Tamp Bay Times Wednesday.

Hudek said that he bought the edible weed in Seattle and ate it before he got on the plane, according to court documents.

“My understanding is that it was legal to buy and consume marijuana in the state,” Hudek said in an affidavit. “After purchasing the edible marijuana, I ate it.”

A federal judge allowed Hudek to leave jail until his trial in February where he faces four assault charges and a charge of interference with a flight crew. He faces 20 years to life in jail.

Hudek, a Tampa Bay native is allowed to go home until the trial, but must get to Florida from Seattle without flying. The judge barred Hudek from flying, marijuana and alcohol, according to the Associated Press.

“I have never had a remotely similar incident in all my times of flying on an airplane,” Hudek said in the affidavit.

Hudek said that he also had one beer on the flight. He flew first class with a free ticket his mother had gotten him; she works for Delta. About an hour into Hudek allegedly went to the bathroom and returned shirtless. He tried to open the plane’s door and yelled: “I want to get out.”

Flight attendants tried to restrain Hudek, but he allegedly began striking out at them, punching one several times. He punched one passenger in the face and hit them with a wine bottle. He was eventually restrained.