Israel and Hamas agreed Wednesday to pause fighting in Gaza so that the remaining hostages there can be freed in the coming days in exchange for Palestinian prisoners, accepting elements of a plan put forward by the Trump administration that would represent the biggest breakthrough in months in the devastating two-year-old war.

“This means that ALL of the Hostages will be released very soon, and Israel will withdraw their Troops to an agreed upon line as the first steps toward a Strong, Durable, and Everlasting Peace,” President Donald Trump wrote on social media in trumpeting the agreement. “All Parties will be treated fairly!”

Israel and Hamas separately confirmed the contours of their deal, which drew celebratory gatherings from hostage families in Tel Aviv and cautious optimism from some in Gaza.

Hamas intends to release all 20 living hostages in a matter of days, while the Israeli military will begin a withdrawal from the majority of Gaza, people familiar with the matter told The Associated Press on condition of anonymity to discuss details of an agreement that has not fully been made public.

Video released by the Hostage and Missing Families Forum showed relatives of hostages, with U.S. Commerce Secretary Howard Lutnick speaking on the phone with President Trump on Wednesday night.

The people cheered as Trump told them that the hostages would be released on Monday.