JERUSALEM (AP) -- Israeli Prime Minister Benjamin Netanyahu on Wednesday completed the formation of a new coalition government, reaching a last-minute deal with a nationalist party just before a midnight deadline.
The late-night deal saved Netanyahu from the unthinkable scenario of being forced from office. But it set the stage for the formation of a narrow coalition dominated by hard-line and religious parties that appears to be on a collision course with the U.S. and other allies.
With a slim majority of just 61 seats in the 120-seat parliament, Netanyahu could also struggle to press forward with a domestic agenda.
After Netanyahu's Likud Party won March 17 elections with 30 seats, it seemed he would have a relatively easy time forming a coalition. But during a six-week negotiating process, the task turned out to be much more difficult than anticipated, as rival coalition partners and members of the Likud jockeyed for influential Cabinet ministries.
Netanyahu - Israel elections
Israel's Netanyahu completes formation of government
A screen shows an exit poll estimation of the first results of Israel's parliamentary election with Israeli Prime Minister Benjamin's Netanyahu Likud party and Herzog Isaac centre-left Zionist Union neck-and-neck in Tel Aviv on March 17, 2015. AFP PHOTO / JACK GUEZ (Photo credit should read JACK GUEZ/AFP/Getty Images)
KIRYAT YEARIM, ISRAEL - MARCH 17: An Orthodox Jewish man casts his ballot at a polling station on election day on March 17, 2015 in Kiryat Ye'arim, Israel. Israel's general election voting has begun today as polls show on that Chairman of the Zionist Union party, Isaac Herzog stands as the only rival to current Prime Minister Benjamin Netanyahu. (Photo by Lior Mizrahi/Getty Images)
WASHINGTON, DC - MARCH 3:
Israel's Prime Minister Benjamin Netanyahu speaks before joint session of Congress, on March, 03, 2015 in Washington, DC.
(Photo by Bill O'Leary/The Washington Post via Getty Images)
Israeli Prime Minister Benjamin Netanyahu went neck and neck with Zionist Union Party leader Issac Herzog but ultimately pulled away in the election.
Co-leaders of the Zionist Union party, Israeli Labour Party leader Isaac Herzog (L) and Israeli MP Tzipi Livni, speak to the media in Modiin, near Tel Aviv, on March 17, 2015 as Israelis vote in a close-fought election pitting the centre left against Prime Minister Benjamin Netanyahu who is fighting for his political survival after six years in power. AFP PHOTO / GIL COHEN-MAGEN (Photo credit should read GIL COHEN MAGEN/AFP/Getty Images)
Israeli Prime Minister Benjamin Netanyahu looks on as he opens the weekly cabinet meeting at his Jerusalem office on February 1, 2015. AFP PHOTO / POOL / GALI TIBBON (Photo credit should read GALI TIBBON/AFP/Getty Images)
As Israeli soldiers cast early votes in Israel's upcoming election, the outlook for sitting Prime Minister Benjamin Netanyahu is not good. Challengers Isaac Herzog and Tzipi Livni -- whom Netanyahu booted from the government late last year -- and their Zionist Union look likely to win the most seats in Israel's parliament, with Netanyahu's Likud Party about four seats behind.
TEL AVIV, ISRAEL - MARCH 17: Supporters of Israeli Prime Minister Benjamin Netanyahu celebrate as election results come in at his election campaign headquarters on March 17, 2015 in Tel Aviv, Israel. After the ballot boxes were closed at 10 P.M. Tuesday, exit polls showed the two main contenders, Netanyahu of Likud and Isaac Herzog of the Zionist Union party, were neck and neck with 27 Knesset seats each, with a slight lead for Likud. Netanyahu has announced a 'great victory'. (Photo by Lior Mizrahi/Getty Images)
WASHINGTON, DC - MARCH 3: Anti-Zionist Orthodox Jews protest Israeli Prime Minister Benjamin Netanyahu's address to Congress outside the U.S. Capitol on March 3, 2015 in Washington, D.C. Netanyahu will speak to Congress on Iran's nuclear ambitions and President Obama's emerging deal with Tehran. (Photo by Gabriella Demczuk/Getty Images)
WASHINGTON, DC - MARCH 3: An Anti-Zionist Orthodox Jew protests Israeli Prime Minister Benjamin Netanyahu's address to Congress outside the U.S. Capitol on March 3, 2015 in Washington, D.C. Netanyahu will speak to Congress on Iran's nuclear ambitions and President Obama's emerging deal with Tehran. (Photo by Gabriella Demczuk/Getty Images)
Israeli Likud Party supporters react to the exit polls while they wait for the announcement of the first official results of Israel's parliamentary elections on March 17, 2015 at the party's headquarters in the city of Tel Aviv. Israeli Prime Minister Benjamin Netanyahu's rightwing Likud party is neck-and-neck with the centre-left Zionist Union in the general election, exit polls said. AFP PHOTO / MENAHEM KAHANA (Photo credit should read MENAHEM KAHANA/AFP/Getty Images)
Discover More Like This
BACK TO SLIDE
The talks stalled this week when Foreign Minister Avigdor Lieberman, a longtime partner of Netanyahu's, unexpectedly stepped down and announced his secular nationalist Yisrael Beitenu party was joining the opposition.
That left Netanyahu dependent on Jewish Home leader Naftali Bennett, a former aide who has a rocky relationship with Netanyahu. The talks with Bennett stretched throughout the day and well into the night before Netanyahu called President Reuven Rivlin, as required by law, to announce the deal.
Netanyahu had until midnight to speak to Rivlin. Otherwise, the president would have been required to ask another politician to try to form a government.
The Jewish Home party is linked to the West Bank settler movement. It opposes peace moves toward the Palestinians and has pushed for increased settlement construction on occupied lands - a policy that is opposed by the U.S. and European countries.
His other partners include Kulanu, a centrist party focused on economic issues, and two ultra-Orthodox religious parties.