“You have to know something about” defense, Mr. Gabbay said, adding: “It’s not like being a minister of environmental protection.”

So in May 2016, Mr. Gabbay quit.

After retreating to Mykonos in Greece, toting biographies of the former prime ministers David Ben-Gurion and Menachem Begin, Mr. Gabbay said he decided to run for prime minister himself to change the political culture in Israel, something that he says can only be achieved from the very top.

He chose Labor as his vehicle like a motorhead snapping up a wreck to restore: Its poll ratings were at record lows, and it was projected to win only eight of 120 Knesset seats. “People told me, ‘You are crazy,’” he said. “‘You are going to join this corpse? Seriously?’”

They may not have appreciated his endurance. A veteran of eight marathons, with a tattoo of a runner under his suit, he barely caught his breath after the primary before beginning his campaign for prime minister, even though an election could be a year or two away.

To Mr. Gabbay, the biggest problem with Mr. Netanyahu, and what will make it difficult to topple him, is his exploitation of identity politics, all too easy in Israel’s fractured society. “The mission of a prime minister is to be a prime minister of all the people in the country — not your camp, your side,” he said.

That said, Mr. Gabbay, a son of Moroccan immigrants who spent his early years in a transit camp, can hope for support from other Mizrahi Jews, whose resentments have been a powerful force in the past. “I am coming from the people, I am not from the elite,” he said. His wife is a teacher; a brother drives a taxi. He would doubtless be the first prime minister who once waited tables in the Knesset cafeteria.

A self-declared social democrat, he assails dog-eat-dog capitalism and pledges to repair the safety net and solve the country’s critical shortage of affordable housing. “We have to change Israel from a country where people just survive,” he said, “to one where people actually live.”