The Hamas leader, Khaled Meshaal, is set to visit Gaza for the first time this week to join celebrations marking the Islamist organisation's 25th anniversary and to offer congratulations on what it regards as a victory against Israel in the recent conflict.

The visit of Meshaal, who has been in exile from the Palestinian territories for 45 years, may also signal a rapprochement between the internal and external leaderships of Hamas, and a new enthusiasm for reconciliation with rival West Bank-based faction Fatah.

Thousands of people are expected to attend a triumphant rally in Gaza City on Saturday, which Meshaal is due to address. Cities throughout the Gaza Strip have been decked out with green Hamas flags ahead of the celebration. A huge mock rocket, emblazoned "M75" – the name Hamas has bestowed on its new long-range missiles – and "Made in Gaza", reaches 50ft into the air at the rally site.

Hamas is in buoyant mood following the eight-day war with Israel despite the destruction of its offices, training grounds and weapons stockpiles, and the deaths of more than 160 Palestinians, most of whom were civilians.

Hamas believes it held its ground against Israel's military onslaught and forced the Israeli government to accept its conditions for a ceasefire. Negotiations on the details of the agreement, including a further significant easing of Israel's blockade of Gaza, are continuing in Cairo, Egypt.

"We believe Israel lost this war, and that victory is ours," said Hamas government spokesman Taher al-Nounou. "Not a military victory, but a victory for our will. At the end, the Israeli side accepted our demands for ending it."

Following the ceasefire deal, Meshaal told a press conference in Cairo: "We have come out of this battle with our heads held high."

His expected visit illustrates an apparent new harmony in relations between the exiled Hamas chief and the Gaza-based leadership, which has been strained over the past year on the issue of reconciliation between the Islamist organisation and Fatah, the dominant faction in the Ramallah-based Palestinian Authority.

Meshaal has been a strong advocate of rapprochement between the two factions. Despite both Fatah and the Gaza-based Hamas leadership publicly saying they favour reconciliation, in practice both sides hitherto resisted.

This week Nounou listed reconciliation among Hamas's top priorities. "We will do our best to implement it. We are ready," he said.

Hamas believes the recent conflict strengthened its hand vis-a-vis Fatah. It claims demonstrations in the West Bank during the offensive signalled support for armed resistance over Fatah's preferred political and diplomatic strategy. And, despite Mahmoud Abbas's recent successful bid to win recognition for the state of Palestine at the UN, Hamas regards the Palestinian president as weak and unpopular.

Signs that the two factions may be moving closer towards reconciliation include Abbas conveying congratulations to Hamas on its "victory" in the eight-day war, and Hamas's belated support for Abbas's UN statehood bid.

This week Hamas allowed 12 members of the rival faction to return to Gaza for the first time since bloody street battles between rival members in 2006. More are expected in the coming weeks. Both factions have agreed to the reciprocal release of prisoners held in jails in the West Bank and Gaza, according to the Palestinian news agency Ma'an.

Hamas also feels emboldened and legitimised by recent regional engagement, including several high-profile appearances in Gaza of Arab and Turkish politicians during the recent conflict, and a visit this week by a delegation of European parliamentarians.

Cairo is heavily involved in attempts to reconcile the two factions. The emir of Qatar, on a visit to Gaza before the recent conflict, said the division harmed the Palestinian cause and "it is time you end the chapter of differences and open a wide chapter for reconciliation".

Earlier this week, Abbas was quoted as telling a meeting of the Palestinian Authority leadership: "It is time to seriously deal with reconciliation … this question has gone on for too long."

However, past attempts at reconciliation have foundered despite encouragement by Arab nations.