The Israeli government has approved a Qatar-mediated deal where Hamas will free Israeli hostages in exchange for a four-day ceasefire in Gaza and the release of dozens of Palestinians held in prisons in Israel.

The Cabinet decided on the deal after more than five hours of deliberation. It will be the biggest diplomatic success and the first meaningful truce since the conflict began if the accord is implemented.

During the first part of the two-phase agreement, Hamas is expected to release about fifty Israeli women and children who were kidnapped in Gaza; during the four-day break, Israel is slated to free about 150 Palestinian prisoners, most of them are women and children.

READ MORE: Emily Hand's family and friends hold vigil on birthday of Irish girl held hostage in Gaza

According to an Israeli official, additional gasoline would be allowed during the cease-fire, enabling Gaza's hospitals to reopen. During the second phase, Hamas might free dozens more women, children, and senior persons in return for Israel prolonging the ceasefire by a few more days.

About 240 people, including Americans, were abducted on October 7 during the Hamas attack. Since then, two Americans have been released out of the four hostages; the other two were found dead.

Axios reports that three far-right Religious Zionist Party ministers, who had announced prior to the conference that they would vote against the pact, had subsequently altered their decisions upon discovering that the heads of the security services had recommended supporting it.

Israeli Prime Minister Benjamin Netanyahu said Israel would resume its offensive against Hamas after the ceasefire expires. It was not immediately clear when the truce would go into effect. Mr Netanyahu convened his Cabinet for the vote late on Tuesday.

The meeting stretched well into the early hours on Wednesday, underscoring the sensitivity of a proposal that would suspend an Israeli offensive against Hamas before it has reached its goals. Ahead of the vote, Mr Netanyahu sought to assure the government ministers that the break was only tactical, vowing to resume the offensive after the truce expires. Top security officials also attended the meeting.

"We are at war, and we will continue the war," Mr Netanyahu said. "We will continue until we achieve all our goals." Israel has vowed to continue the war until it destroys Hamas' military capabilities and returns all hostages.

Mr Netanyahu said that during the lull, intelligence efforts will be maintained, allowing the army to prepare for the next stages of battle. He said the battle would continue until "Gaza will not threaten Israel."

The deal does not mean an end to the war. In weeks of Israeli airstrikes and a ground invasion, more than 11,000 Palestinians have been killed, two-thirds of them women and minors, and more than 2,700 others are missing and believed to be buried under rubble, according to Gaza's health ministry.