The UN security council rejected a Palestinian resolution demanding an end to Israeli occupation within three years after Israel and the US crucially intervened to persuade Nigeria to abstain from voting.

Palestinian officials and other observers had thought Nigeria would back a Jordanian-tabled resolution, thereby delivering a nine-vote majority on the council which would have required a US veto to be blocked. Washington had been working strenuously to avoid having to use its veto.

Until shortly before the vote on Tuesday, council diplomats had expected the resolution to get nine yes votes. But Nigeria abstained, with its ambassador, U Joy Ogwu, echoing the US position in saying that the path to peace lay “in a negotiated solution”.

One Palestinian source involved in the negotiations told the Guardian: “Even half an hour before the vote, Nigeria indicated it was committed to voting for the resolution. We knew that Rwanda, South Korea and Australia would not back it, but we believed Nigeria was on board.”

The apparent change by Nigeria, which is a rotating member of the council, came after both the Israeli prime minister, Binyamin Netanyahu, and the US secretary of state, John Kerry, phoned the country’s president, Goodluck Jonathan, to ask him not to support the resolution.

A State Department spokesman said on Tuesday that Kerry had called a number of senior foreign officials, including Jonathan, before the vote. Arriving at primary elections for leadership of his Likud party on Wednesday, Netanyahu confirmed he had spoken to both Paul Kagame of Rwanda and Jonathan before the UN vote. “I spoke with both of them,” he told reporters. “They promised me personally that they would not support this decision and they stood by their words. That is what tipped the scales.”

Netanyahu had a private meeting with the Nigerian president – seen by Israel as a potential ally on the security council – during the latter’s pilgrimage to Jerusalem in October.

Only eight countries voted in favour of the resolution, with the US – which opposed the motion – not using the veto it is granted as one of the five permanent members of the council.

After the vote, the Israeli foreign minister, Avigdor Lieberman, took a swipe at the European countries which backed the resolution. “The Palestinian disregard to the international community’s most important countries – particularly the US – stems from the backing they receive from certain European countries,” he said.

Palestinian and French officials indicated they would continue working to find a text to put to the council, perhaps within weeks.

Before the vote, the chief Palestinian negotiator, Saeb Erekat, said the Palestinians could return to the security council, which, from Thursday, will have five new members who are viewed as more sympathetic to their cause.

The Palestinian leadership was due to meet on Wednesday evening to consider its response, including whether to apply immediately for membership of the international criminal court, a move the Palestinian president, Mahmoud Abbas, has long been threatening to make.

However, despite the defeat for the Arab-supported campaign to gain security council backing for a move towards a Palestinian state, the vote held minimal comfort for Israel as it saw two European countries, France and Luxembourg, support the resolution. Only the US and Australia voted against it.

Palestinian officials had long believed the resolution was likely to be defeated by a US veto but had hoped to secure the nine votes to highlight what they argue is Washington’s partisan advocacy on behalf of Israel in the Middle East peace process.

The US, Israel’s closest ally, had made clear it opposed the set timetable in the draft resolution, insisting instead on a negotiated peace agreement between the Israelis and Palestinians.

“We voted against this resolution not because we are comfortable with the status quo. We voted against it because ... peace must come from hard compromises that occur at the negotiating table,” the US ambassador to the UN, Samantha Power, said.

She described the decision to bring the draft resolution to a vote as a “staged confrontation that will not bring the parties closer”. Of the resolution itself, she said it was “deeply unbalanced” and didn’t take into account Israel’s security concerns.

“Our effort was a serious effort, genuine effort, to open the door for peace,” said Riyad Mansour, the Palestinian ambassador to the UN. “Unfortunately, the security council is not ready to listen to that message.”

Erekat said in a statement after the vote: “We presented a resolution that is fully in line with international law, and which recalls several previously approved resolutions by the United Nations. “Although the majority of the security council voted in favour of the resolution, once again, certain countries continue to ensure impunity to the Israeli occupation and its severe international law violations by not voting in favour of the resolution.”