JERUSALEM — The near-final results of Israel’s intensely fought election gave rise on Wednesday to a seemingly contradictory conclusion: While the country remains deeply divided, the forces of unity have gained an edge.

Prime Minister Benjamin Netanyahu, who sought to drive wedges through the electorate along religious, ethnic and ideological lines, appeared to have come in a close second to the centrist former army chief Benny Gantz.

Mr. Gantz and another party leader, Mr. Netanyahu’s former deputy, Avigdor Liberman, who won a kingmaker’s role, have advocated a broad coalition that would govern from the center and sideline the more extreme elements of Israeli politics.

That would mean that after a Netanyahu government beholden to the hard right and the ultra-Orthodox, a less polarizing administration could take shape that heeds the desires and interests of a broad majority of Israelis, many of them more secular in outlook.