TAMPA — A Tampa man says edible marijuana caused him to try to exit a plane mid-flight and then assault passengers and crew in July.

Joseph Hudek IV was on a Delta flight from Seattle to Beijing when he tried to open a door and then punched an attendant and passenger who were helping to subdue him.

In an affidavit, Hudek said he ingested the drugs in Seattle just before getting on the plane.

"My understanding is that it was legal to buy and consume marijuana in the state," he wrote. "After purchasing the edible marijuana, I ate it."

That was enough for a federal magistrate judge Tuesday to let him out of jail until his trial, which is scheduled for February.

Prosecutors indicted Hudek on four assault charges and a charge of interference with a flight crew. He faces 20 years to life in prison if convicted.

But now Hudek, a Plant High School graduate, can pass the time before his trial at his mother's South Tampa home — as long as he doesn't fly there. The judge said he must travel from Seattle by train or car.

In the affidavit, Hudek also promised to steer clear of any use of marijuana. He will have to take regular drug tests.

According to court documents, Hudek texted several friends before the July 6 flight with pictures of "two or three bags of marijuana edibles." The friends told investigators he has a history of regular marijuana use, and has used cocaine at least once.

His mother, Linda Hudek, told investigators he purchased marijuana-laced candy that day but did not have a history of mental health issues or substance abuse.

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

The incident happened about an hour after the evening flight took off from Seattle-Tacoma International Airport. Hudek was riding in first class, according to court documents, using a ticket that he got free from Delta, where his mother works.

He drank a beer on the plane just before takeoff but no other alcohol. An hour in, he went to the bathroom, exited, returned and then came out again, this time shirtless. He grabbed the handle and tried to open the exit door, shouting, "I want to get out!"

The plane began turning around and flight attendants tried to stop him. Hudek pushed them out of the way, punching one several times. He also punched a passenger in the face and hit him in the back of the head with a wine bottle.

A flight attendant grabbed two wine bottles and hit Hudek with both, breaking one over his head. According to a complaint filed by the FBI in Seattle, "Hudek did not seem impacted by the breaking of a full liter red wine bottle over his head, and instead shouted, 'Do you know who I am?' or words to that effect."

Eventually, the passenger and others restrained him.

Since the flight, his legal team has collected and submitted hundreds of pages of testimonials from Hudek's family, friends and former baseball teammates, who all said that "Jojo" was not a violent person.

One endorsement came from Florida House Minority Leader Janet Cruz, D-Tampa. Cruz wrote on office letterhead that Hudek grew up across the street from her and that she considered him an "honorable and caring" young man.

Another came from his uncle, former All-Star major league pitcher John Hudek, who wrote that the incident "is something that I have never seen from Jojo."

Hudek's physician, Dr. Joe Whitaker of Tampa, filed an affidavit claiming "paranoia, confusion, hallucinations and combativeness" are adverse effects of orally-ingested cannibinoids.

Two other doctors, who were both friends of the Hudeks, said they also believed the drug caused his outburst.

According to the Centers for Disease Control and Prevention, people who take marijuana and alcohol together "can react with panic, anxiety or paranoia." The combination can also "increase the risk of psychotic symptoms" like hallucinations.

Attempts to reach Hudek by phone and at his parents' Tampa homes Wednesday were unsuccessful.

Contact Langston Taylor at ltaylor@tampabay.com. Follow @langstonitaylor.