Yahya Sinwar and his family fled into an tunnel just hours before the Oct. 7 massacre, video released by by the IDF Saturday shows.

The Hamas chief, 61, and his wife can be seen ushering in their two young sons through the narrow bunker hallway in the footage — timestamped at 10:45 p.m. Oct. 6, 2023.

The four appeared to be settling in for the long haul — all four were wearing backpacks and luggage when they entered the chambers.

Hamas leader Yahya Sinwar was killed in a drone strike Wednesday. REUTERS

Sinwar — the mastermind behind the Oct. 7 attacks — made several more trips through the tunnel to retrieve additional belongings, packages of water bottles and pillows.

The older of the two sons ultimately joined his father to carry blankets into the hideaway — which IDF images show was outfitted with a TV, floor and wall fans, beds and a tile floor.

The footage was found a few months ago by IDF and ISA forces, the Jewish State military said.

The IDF had been hunting Sinwar since he brainstormed the terror organization’s deadly attack on southern Israel on Oct. 7, 2023.

They finally took out the leader Wednesday in a chance encounter — soldiers discovered his body while sifting through rubble in the wake of an airstrike in Tel al-Sultan.

The IDF released video of Sinwar ushering his family into an underground bunker hours before the Oct. 7 massacre. Israel Defense Forces/YouTube

Sinwar’s wife carried a purse as she fled. Israel Defense Forces/YouTube

Sinwar was killed in an Israeli tank strike. Israel Defense Forces/YouTube

Drone footage of the attack showed a man later identified as Sinwar sitting on a couch in an above-ground building with a cloth covering his face and sporting what appeared to be a wounded arm.

He can be seen weakly tossing a piece of wood at the drone in a last-ditch attempt to knock it down — just before the building was blown up.

The soldiers found 40,000 shekels ($10,000) and an ID for a United Nations Relief and Works Agency (UNRWA) teacher on Sinwar’s body. Inside the building, they also uncovered a cache of weapons.

Prime Minister Benjamin Netanyahu vowed that the killing would mark a turning point in the year-long Israel-Hamas war, though a senior Hamas official said the group would only get stronger in the wake of its loss.