A co-pilot on a Flydubai flight from Dubai to Tel Aviv stabbed the captain in the cockpit and tried to sabotage the aircraft on Wednesday, before passengers and crew overpowered him and reserve pilots flying as passengers landed the plane in Saudi Arabia, Israeli officials said.

Flight FZ1073, carrying 174 people — 166 of them Israelis — fell 17,400 feet in just under two minutes about two hours after its 6:05 a.m. departure, flight tracking data showed. The plane transmitted a distress call at 8:31 a.m., then squawked code 7500, the international signal for a hijacking, before touching down at Tabuk Airport at 9:54 a.m.

Prime Minister Benjamin Netanyahu of Israel said the attacker, a pilot he did not name, stabbed his colleague and tried to “sabotage the aircraft’s system.” The wounded captain, identified as Smit Machchhar from India, fought back and “managed to prevent a 9/11 disaster,” Mr. Netanyahu told CNN. “What distinguishes this incident from the other tragic attacks was at this time, the good guys won,” he said.

Passengers described a nosedive and panic in the cabin. “We just felt the plane drop completely and start spinning a little, and everyone was screaming, there were children crying,” Mika Bauman, a passenger, told CNN. “I was just sure I was going to die.”

Several passengers rushed the cockpit. Yaniv Hayoun told Mr. Netanyahu he put the attacker in a chokehold and, with other passengers, dragged him out, then grabbed the controls. Dr. Shota Musaev, a dentist on board, told CNN he bound the man with headphone cords and plastic zipties, then treated the wounded captain, who he said had “massive blood loss” and cuts to his head and hands.

“There was nothing but desert beneath us; we feared being taken to an enemy country or landing in the middle of the desert,” another passenger, Assaf Rajuan, told CNN. “We didn’t know who to trust.”

Mr. Netanyahu and Flydubai said reserve pilots traveling in the passenger cabin took over and flew the plane to Tabuk. Video verified by CNN showed the stabbed captain on the floor, conscious, his hands bloodied, and the alleged attacker nearby, guarded by passengers, his white shirt soaked with blood around the stomach. Both men were taken to a hospital. A 50-year-old passenger with an upper-body injury was hospitalized in light condition after the travelers reached Israel on a substitute plane, an Israel Airports Authority spokeswoman said. Four of those on board held both American and Israeli citizenship, according to two U.S. officials.

An Israeli official told CNN the suspect is an Omani national, now held and questioned by Saudi Arabia. Oman, like Saudi Arabia, has no formal diplomatic ties with Israel, and the official said a central question was why the crew included a pilot from such a country and how he was cleared to fly to Israel. The motive and the weapon remain unknown. Shin Bet, Mossad, the military and the transportation ministry are all investigating, and Mr. Netanyahu promised an inquiry in legal forums as well.

Flydubai suspended flights to and from Israel while the investigation proceeds. President Isaac Herzog of Israel called the outcome a “great miracle,” and President Trump, who spoke with Mr. Netanyahu on Wednesday, described the passengers’ efforts as “the most amazing stuff.”

The attempt was the first hijacking bid against a Tel Aviv-bound flight in 50 years, according to El País, which traced the history of attacks on Israeli aviation. In 1968, Palestinian militants diverted an El Al flight to Algiers and held 12 Israeli men for 40 days. In 1976, hijackers took an Air France plane to Entebbe, Uganda, where Israeli commandos freed the hostages in a raid that left four passengers and one soldier dead. Israel’s security regimen — armed plainclothes officers, double cockpit doors, interrogations at departure airports — grew out of that era.

The attack also landed in the last stretch of an election campaign, with the Knesset vote set for Oct. 27. With the motive still unclear, Mr. Netanyahu has been quick to frame the attack as the almost inevitable product of the “propaganda” that vilifies Israel, Al Jazeera reported. He spent part of the day greeting returning passengers at Ben Gurion Airport, where families waited with balloons reading “welcome” and “it’s so good to have you back home.”