Israel has approved the release of 104 long-term Palestinian prisoners in a deal brokered by the US Secretary of State John Kerry.

The agreement paves the way for negotiations in Washington next week that will be the first formal talks between the two sides in almost three years.

Israel's cabinet voted 13 in favour and seven against the move, with two abstentions, after an emotional debate in which Binyamin Netanyahu, the Israeli prime minister, spoke of the need to make painful decisions in order to find peace.

The Palestinians had said they would not participate in the meetings in Washington, which begin on Tuesday, without the prisoners' release being agreed.

The first of four batches of prisoners, most of whom have been in jail for more than 20 years, will be released shortly before Eid al-Fitr, the Muslim holiday marking the end of Ramadan next week. The rest will be freed at intervals over the next nine months.

Netanyahu said: "This moment is not easy for me. It is not easy for the ministers. It is not easy especially for the families, the bereaved families, whose heart I understand. But there are moments in which tough decisions must be made for the good of the country and this is one of those moments."

Opposition to Netanyahu from the Israeli right was bitter. Naftali Bennet, leader of the hawkish Jewish Home party, said: "Terrorists must be killed, not released. Let my hand be cut off should I vote in favour of releasing terrorists. We support the peace process, but no country in the world would agree to release murderers as a gift."

Deputy defence minister Danny Danon, of Likud, said he was against "a crazy release of dozens of terrorists with the blood of hundreds of Israelis on their hands. All the more so, since the release would represent a reward to the Palestinians, just for agreeing to sit with us around the negotiating table".

Transport minister Yisrael Katz voted against the deal, saying: "I am against releasing murderous terrorists. It hurts the bereaved families and encourages terror."

Palestinian negotiator Saeb Erekat welcomed Israel's move, but called it "an overdue step". He said the Palestinian authorities would "continue working for the release of all our political prisoners".

US secretary of state John Kerry had invested months of intensive diplomacy in securing the deal, which now opens the possibility of progress in preliminary talks.

The Palestinians also appear to have made concessions, and dropped demands of written assurances from Kerry that the US would regard the pre-1967 line as the basis for negotiations.

Israeli did not agree to that, nor to a commitment to freeze settlement construction.