The Israeli parliament on Wednesday chose Isaac Herzog, a veteran politician and scion of a prominent Israeli family, as the country's next president. The president in Israel is largely a figurehead, meant to serve as the nation's moral compass and promote unity. The election was conducted at the Knesset, Israel's parliament, where 120 legislators were eligible to cast their votes anonymously. Mr Herzog, 60, is a former head of Israel’s Labour Party and opposition leader who unsuccessfully ran against Israeli Prime Minister Benjamin Netanyahu in the 2013 parliamentary elections. He was elected with 87 votes. He has deep ties to the political establishment as a scion of a prominent Zionist family. His father, Chaim Herzog, was Israel’s ambassador to the United Nations before being elected president. His uncle, Abba Eban, was Israel’s first foreign minister and ambassador to the UN and US. His grandfather was the country’s first chief rabbi. For the past three years since resigning from parliament, Mr Herzog has served as head of the Jewish Agency, a nonprofit organisation that works closely with the government to promote immigration to Israel. He defeated Miriam Peretz, an educator who was seen as a more conservative and nationalist candidate. Mr Herzog will succeed President Reuven Rivlin, who is scheduled to leave office next month. Also on Wednesday, Israel's opposition leader moved closer to unseating Prime Minister Benjamin Netanyahu after agreeing to terms with several parties, including one led by Defence Minister Benny Gantz, for a proposed new government, a spokesman said. Yair Lapid, a centrist given the responsibility of forming the next governing coalition after the conservative Mr Netanyahu failed to do so after an inconclusive election on March 23, has until midnight on Wednesday to present a final slate. Mr Lapid has yet to clinch a deal with his main partner, nationalist Naftali Bennett, who would serve as premier first under a proposed rotation between the two men. Mr Lapid's Yesh Atid party and Mr Gantz's centrist Blue and White said they had "agreed on the outlines of the government and core issues relating to the strengthening of democracy and Israeli society". Mr Gantz would remain defence minister in the new Cabinet, the parties said. Deals were also reached with the left-wing Meretz and centre-left Labour parties, as well as with former defence minister Avigdor Lieberman's nationalist Yisrael Beitenu party, a Lapid spokesman said. The United Arab List was also negotiating to join the coalition. If it does, it would be the first time in Israel's history that an independent Arab party becomes a member of the government. Mr Netanyahu, in power for the past 12 years, has sought to discredit Mr Bennett and two other rightists negotiating with Mr Lapid, saying they were endangering Israel's security. Keeping the door open to them, Israel's longest-serving leader said he is still capable of forming the next government. If Mr Lapid misses Wednesday's deadline – marking the end of a 28-day presidential mandate to put together a coalition – parliament will have three weeks to agree on a new candidate. If that fails, Israel will hold another election, its fifth in two years.