A heroic passenger on a JetBlue flight sprang into action after a crazed pilot banged on the cockpit door and screamed about a bomb.

David Gonzalez, a former corrections officer, told Fox News Anchor Shepard Smith that he subdued the pilot on Flight 191 from John F. Kennedy Airport in New York Tuesday that was diverted to Amarillo, Texas.

He just lost it.

- David Gonzalez, Passenger on Flight

"What I actually witnessed was a radical pilot trying to break into the cockpit," said Gonzalez.

Gonzalez said the pilot at some point left the cockpit and ended up in the back of the plane. Then he started "storming" toward the front and that's "when he just lost it." 

"I think that the co-pilot changed the codes for him to get back in."

Gonzalez said he believed the co-pilot must have witnessed something inside the cockpit when he was in there.

"The pilot started banging on the door to let him in. 'Why did you change the code? We got to drop this plane to 7,000 feet.'"

The flight attendants attempted to stop the pilot from getting in the cockpit in a struggle that intensified.

"It appeared that's what he wanted to do - open up the side door," he said."He wanted to open up that side door."

Gonzalez said he confronted the pilot,Clayton Osborn, and the pilot started yelling  "Iraq and Iran," and shouted that he "better pray right now to Jesus Christ."

"So I said, 'You know what I'm going to show you what Iraq and Iran is,'" he said he told the pilot. "I grabbed him and I choked him." 

After about a two to three minute struggle, Gonzalez said he was able to choke him with his forearm, and that's when he noticed "his knees buckle." He said he continued to apply pressure until the pilot appeared he was going to pass out.

Gonzalez "tackled" him to the floor as other passengers sprang into action, assisting him in tying up the pilot.

The passengers held him down - afraid he would wake up before the plane landed. 

An off-duty captain who just happened to be a passenger on the flight went to the flight deck and took over the duties of the ill captain "once on the ground," the airline said in a statement. 

Before the flight, there was no sign of abnormal behavior from the pilot, Gonzalez explained.

"Before we took off, everything was cool I didn't see any radical behavior with him," Gonzalez told Smith.

JetBlue Airways said in a statement that the captain of Flight 191 from New York had a "medical situation" and that the pilot in command of the aircraft elected to land in Amarillo about 10 a.m.

Grant Heppes, a 22-year-old passenger from New York City, told The Associated Press that a man in a JetBlue uniform walked from the cockpit to the back of the plane, but that he started to become disruptive when he was barred from getting back inside.

"Once he got back to the front of the plane I heard him scream, 'Let me in!'" Heppes said.

Heidi Karg, a passenger on the flight, told reporters that the man was shouting "I need the code, gimme the code, I need to get in there." The pilot used the announcement system to call for someone to restrain him and some male passengers wrestled him to the ground, she said.

"We heard the word 'bomb,'" Karg said. "We didn't know exactly what was going on."

Shane Helton, 39, of Quinlan, Okla., said he saw emergency and security personnel coming on and off the plane as it sat on the tarmac at Rick Husband Amarillo International Airport.

"They pulled one guy out on a stretcher and put him in an ambulance," said Helton, who went to the airport with his fiancée to see one of her sons off as he joined the Navy.

Helton said the ambulance then sat on the tarmac next to the plane for more than 30 minutes.

JetBlue said the ill captain was taken to a medical facility in Amarillo.

Once on the ground and off the plane, authorities interviewed each of the passengers, Heppes said.

The FBI was coordinating an investigation with the airport police, Amarillo police, the Federal Aviation Administration and the Transportation Safety Administration, according to agency spokeswoman Lydia Maese in Dallas.

She declined to comment on whether any arrest had been made.

Based on reporting by the Associated Press.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino