JERUSALEM — Prime Minister Benjamin Netanyahu’s two main rivals in Israel’s upcoming election pledged Thursday to run against him on a joint ticket, increasing the pressure he faces even as he came under fire for making a pact with a far-right extremist party.

Benny Gantz, a former army chief of staff, and Yair Lapid, a longtime opponent of the prime minister, said they were joining forces out of “national responsibility” and would run on a joint ticket called “Blue and White” — the colors of the Israeli flag. Gantz and Lapid have been largely polling in second and third place, respectively, ahead of the April 9 election.

One poll carried out before the political alliance was announced found that a merger between Gantz and Lapid would put them a hair ahead of Netanyahu. Israeli news channels, polling the Israeli public after the announcement, projected the new party would win as many as 36 seats in the 120-member Knesset, or parliament, and Netanyahu’s ruling Likud party would take as few as 26 seats.

In the past, Netanyahu has come from behind to win, and some political analysts say he thrives in the role of an underdog because he can galvanize his core supporters with the prospect he may lose. Netanyahu has been prime minister for more than 13 years and is now serving his fourth term.

However, this year’s elections include a wild card. Before Israelis go to the ballot box, Israel’s attorney general is expected to announce a decision on whether he intends to indict the prime minister in connection with three corruption cases. 

“Bibi is always winning when he’s trailing in the campaign,” but he gets fewer seats than predicted when leading in the polls, said Ben Caspit, an Israeli columnist who wrote a recent biography of Netanyahu, who is also known as “Bibi.”

But this time there may be more panic, he added, with a more challenging opposition. Gantz’s ticket now includes three former army chiefs of staff. Gabi Ashkenazi joined the party Thursday, and Moshe “Bogie” Yaalon, who also once served as defense minister, joined Gantz last month. 

“I don’t think it’s a very happy morning on Balfour Street this morning,” Caspit said, referring to the prime minister’s residence.  

If Netanyahu does win, the prospect of being indicted may make it hard for him and his Likud party to find coalition partners. That appears to have been on his mind when the prime minister joined forces Wednesday with three right-wing factions, making them potential coalition partners in a new government.

One of those factions is Otzma Yehudit, or Jewish Power, made up of followers of the late Meir Kahane, an ultranationalist American Israeli rabbi. Israeli commentators and U.S. Jewish groups immediately decried the move, saying the faction was clearly an offshoot of Kahane’s Kach party, a group that is designated a terrorist organization by the State Department and banned in Israel. 

It was outlawed in Israel in 1994 after one of the party’s supporters, Baruch Goldstein, fatally shot 29 Palestinians as they prayed at a mosque in Hebron. The group had advocated banning mixed relationships and expelling non-Jews from Israel. 

The Jewish American magazine Forward compared the deal to striking an agreement with Israel’s equivalent of the Ku Klux Klan. 

Rabbi Rick Jacobs, president of the Union for Reform Judaism, tweeted that it was “morally outrageous” to imagine that those who had followed Kahane could be welcomed into Netanyahu’s political circle. “Bolstering one’s political strength with those who profess racist views should be unthinkable,” he said. 

The liberal advocacy group J Street called it disgraceful and dangerous, adding that the move showed there was no line the prime minister wouldn’t cross in his “desperate attempt to remain in office.”

“We call on U.S. officials and pro-Israel organizations to condemn Netanyahu’s efforts to bring these extreme racists into Israel’s next government,” it said.  

However, Netanyahu has argued that right-wing votes should not be “wasted” and that the three groups should merge.  

Likud agreed to reserve the 28th spot on its parliamentary list for the Jewish Home party and grant it two cabinet ministries in a future government if it merged with Jewish Power and another right-wing faction, National Union. There had been resistance among the right-wing Jewish Home and the National Union about teaming up, with Jewish Power seen by many even in the right wing as the radical fringe. 

But the merger was so important to Netanyahu that he canceled a visit to meet with Russian President Vladimir Putin in Moscow on Thursday, huddling instead with former chief military rabbi Rafi Peretz, head of Jewish Home, the largest of the three right-wing factions.

The deal gives Jewish Power the fifth and eighth slots on the joint ticket, meaning that if the alliance wins five seats, the party will be represented in the Knesset. 

“Netanyahu lowered all of us not only below the bottom red line but also set a new bar for low,” journalist Ben-Dror Yemini wrote in the Israeli daily Yedioth Ahronoth. “There is only one explanation for Netanyahu’s odd behavior: He is panicking.” He added that bringing in the Kahanists will be “a gift greater than gold to Israel-haters” and deepen the rift between American Jews and Israel. 

Netanyahu is willing to “trample” the national interest for a small gain, Yemini wrote. 

Gantz, the former army chief of staff, said Netanyahu has “lost touch with Zionism and his dignity.”  

“The new ruling party will bring forth a cadre of security and social leaders to ensure Israel’s security and to reconnect its people and heal the divide within Israeli society,” Blue and White said in a statement.

In the statement, issued Thursday morning just hours before a deadline to declare party lists for the April 9 election, Gantz and Lapid said they had agreed on a rotation for the prime minister’s post. If they win, Gantz would serve as prime minister for the first 2 1/ years, and Lapid would assume the post afterward.

Netanyahu has presented the choice for voters as a simple one between a weak leftist government that would sell out Israeli interests and a strong right-wing one headed by him. 

A Likud statement immediately attacked the merger, calling it a left-wing government, even though Yaalon is considered further right on the political spectrum than Netanyahu, as are other candidates on Gantz’s ticket.

“The choice is clear,” said the Likud statement. “Either Lapid-Gantz’s left-wing government with the support of a block of Arab parties, or a right-wing government headed by Netanyahu.”