Israeli legislators have voted against a bill to retroactively legalise settler homes built on private Palestinian land, in a move which has sharply divided prime minister Binyamin Netanyahu’s ruling coalition.

The bill was an attempt to circumvent a Supreme Court ruling ordering the removal of five buildings from a settlement outpost known as the Ulpana neighbourhood by July 1.

The planned demolition, which would affect 142 people, has sparked fury among settlers and their supporters in parliament, with right-wing parliamentarians set to bring the two bills for debate and a vote in a Knesset session later on Wednesday.

The legislation would essentially have legalised the outpost in the eyes of the Israelis and offered compensation to the Palestinian landowners.

In depth Al Jazeera’s Nadim Baba reports on the conflict over the illegal settlements. As expected, hundreds of Israeli settlers descended on the Israeli parliament on Wednesday, lending their support to a bill that would have saved an illegal outpost in the occupied West Bank. But the bill was defeated far more resoundingly than many predicted. The result was 69-22 against “legalising” the outpost of five houses in the Beit El settlement. According to Israel’s High Court, the houses were built on privately-owned Palestinian land and should be removed by July 1. But just about every settler that I spoke to at the Knesset demonstration said they were appalled by Binyamin Netanyahu’s hardline stance, which involved threatening to fire ministers who backed the legislation. On the other hand, Netanyahu is offering not just to relocate the houses within Beit El, but to build homes for 300 more families to move there. Not surprisingly, that has angered Palestinian activists, who accuse Netanyahu of giving in to pressure from the settlers. His insistence on continuing to expand what Israel calls “authorised” settlements, which are illegal under international law, is cited by the Palestinians as the reason they will not restart direct negotiations. Domestically, though, Netanyahu now has to defend himself against accusations of betrayal by the settlers, and he has caused major disquiet within his Likud party.

Israel differentiates between “legal” settlements and “illegal” outposts, but the international community views all settlements on occupied territory as a violation of international law.

Netanyahu strongly opposes the bill on the grounds it would create an international backlash, and has reportedly threatened to sack any cabinet minister or deputy who backs the proposed legislation.

He has said he backs the idea of physically relocating the five buildings, moving them stone by stone to a new location, in a plan which is being examined by Attorney General Yehuda Weinstein.

Despite a commanding majority of 94 within the 120-seat coalition, Netanyahu has struggled to rein in the far-right members of his ruling right-wing Likud party, many of whom have said they will back the move to legalise the Ulpana homes.

Protest march

At least two ministers have said they will back the bill – Yuli Edelstein, a Likud minister who holds the public diplomacy portfolio, and Science Minister Daniel Hershkowitz, who heads the Jewish Home party.

But after some hesitation, Foreign Minister Avigdor Lieberman, who heads the ultra-nationalist Yisrael Beitenu faction, said he and his party of 15 seats would vote against, a statement said.

Meanwhile, hundreds of settlers began the last leg of a three-day march to Jerusalem in support of the bill.

The march began on Monday morning outside the condemned buildings, which lie on the outskirts of the Beit El settlement near Ramallah.

Al Jazeera’s Nadim Baba, reporting from Jerusalem, said hundreds of people had gathered in the city.

“They carry banners saying ‘if you’re not with us, you’re against us’. That’s the message to politicians, particularly to Prime Minister Netanyahu.” he said.

“What everyone is wondering is exactly how far it [the vote] will lead to a split within the prime minister’s own party.”

Negotiations between Israel and the Palestinians broke down three years ago, and the Palestinians refuse to restart negotiations until Israel freezes settlement construction in the occupied West Bank and East Jerusalem.

The Palestinians claim both areas, captured by Israel in the 1967 Middle East war, for a future state.

Netanyahu says talks should resume without any preconditions and has refused calls for a full settlement freeze.