Ronen Zvulun / Reuters, file
Yair Lapid, right, stands behind Israeli President Shimon Peres, who is seated next to Benjamin Netanyahu, at a reception in Jerusalem on Feb. 5. Lapid, a relative newcomer, has been able to gain numerous concessions from the veteran Netanyahu as the latter struggled to form a coalition government.
TEL AVIV -- It is no surprise that Benjamin Netanyahu will be Israel's prime minister for the third time. The makeup of his Cabinet, however, may be jarring, especially to him.
Two days before the deadline imposed by election rules, he overcame the final obstacles and reached a compromise with Yair Lapid, the political novice who heads the second-largest party in the Israeli Knesset.
The agreement, which is expected to be signed Thursday, gives his coalition 68 seats out of 120 in the new parliament, which should be sworn in next week.
Lapid may be a novice, but analysts here say he achieved major victories over the prime minister. He demanded that there be a maximum of 20 Cabinet ministers instead of the bloated 30.
Struggling to find seats for his party members, Netanyahu fought tooth and nail against Lapid and lost. There are now likely to be 22, including Netanyahu.
Netanyahu was determined to keep the education portfolio for his own party. Lapid insisted on having it and appears to have won.
It didn't all go Lapid's way, but the message to the voters is clear: Lapid is the man to watch. Indeed, the former television host has already let it be known that he wants to be Israel's next prime minister.
If Lapid, and for other reasons Naftali Bennett and Avigdor Lieberman, were the winners in the Jan. 22 elections, the losers, to a large extent, were the ultra-orthodox religious parties. The Haredim, as they are known here, who form 10 percent of Israel's population and are by far the fastest-growing group, have no seat at the Cabinet table.
That means the government has the opportunity to cut the funds devoted to ultra-orthodox institutions such as their study yeshivas and schools, which in the 2012 education budget totaled close to $1 billion.
Large state subsidies go to their traditionally large families and fund the men who study the Torah full time. These are some of the issues that upset Lapid and his voters, and that now, as Israel's minister of finance, he would have an opportunity to change. That's why control of the education ministry was so important to him: Most yeshiva funding goes through that ministry.
This is not what Netanyahu wanted. He wanted his usual rightist/ultra-orthodox coalition. Instead, through failed brinksmanship he ended up with exactly the opposite: a coalition of his rightist party, Likud-Beitenu, with the left and center, as well as with his natural partner, another new young politician, Naftali Bennett, who leads a rightist party that coordinated every move with Yair Lapid.
Blame the wife. That's what the analysts here say. Bennett, who was once Netanyau's chief of staff, had a major falling out with Sara Netanyahu, ending in bad blood between him and the prime minister.
The natural coalition after the January elections was between the two rightist parties, Netanyahu's 31 seats and Bennett's 12 seats, which would have guaranteed them power if allied with the ultra-orthodox parties. Experts say Netanyahu should have drafted Bennett to the cause immediately.
Instead Netanyahu miscalculated and, reportedly because of personal animus, tried to form the basis of a government without him.
That drove Bennett into the arms of Lapid, where he stayed. The two new young leaders displayed a virtue rare in politics: loyalty to an ideological opponent, based on the power of their word.
Result: Netanyahu has what he most wants, the position of prime minister. But he has the Cabinet that he least wants. A rocky term awaits him.
NBC News' Martin Fletcher is the author of "The List,""Breaking News" and "Walking Israel."