But the scenes of joy at his arrival in this small splinter of land could not disguise deep-rooted disunity between the Palestinian factions, ensuring its people remain divided both geographically and politically.
Born in the nearby West Bank, 56-year-old Mashaal has lived in exile for most of his life, serving as a vital pointman for his Islamist group with its closest allies -- once Syria and Iran, now Egypt and Qatar.
The target of a botched Israeli assassination plot in 1997, Mashaal felt safe enough to come to Gaza on Friday, following last month's short, deadly conflict with Israel.
Egypt underwrote the ceasefire, something that is likely to have reassured Mashaal that Israel would not try to kill him on such a visit.
He was given a hero's welcome and policemen, lined up neatly to welcome him as he crossed the Egyptian border, failed to maintain any semblance of discipline, breaking rank to surround the bearded Mashaal and seeking to hug and touch him.
"I kissed his head," said 27-year-old policeman Mohammed Abed. "This is the most beautiful day in my life," he said before calling his wife to check if she had seen him on Hamas television, which broadcast the visit live throughout the day.
A haphazard escort of flag-carrying security guards followed Mashaal's motorcade along Gaza's often bumpy roads.
Women and children stood and waved while crowds chanted their thanks to Hamas fighters who waged a rocket war against Israel in the recent, eight-day conflict that killed some 170 Palestinians and six Israelis - mostly civilians.
"Gaza lives forever thanks to its fighters and people," said 44-year-old public sector worker, Abu Mohamed.
"Mashaal's visit is a first step. We hope Fatah and Hamas will join hands for the sake of Palestine," he added, referring to the two main forces on the Palestinian political landscape.Yearning for reconciliation
Hamas won national elections in 2006 and seized control of Gaza in a brief civil war against its secular rival Fatah in 2007. Fatah, led by President Mahmoud Abbas, still governs in the West Bank and repeated attempts to overcome the divide have ended in acrimony.
"I had hoped Mashaal would come hand in hand with Abu Mazen (Abbas). That would have been a real national day," said Umm Ali, a middle-aged woman standing on a chair to get a glimpse of the Hamas leader previously only seen here on posters or TV.
Clearly aware of the yearning for reconciliation, Mashaal repeatedly returned to the subject during his many stops around Gaza, home to some 1.7 million mostly impoverished Palestinians.
"With God's will ... reconciliation will be achieved. National unity is at hand," Mashaal shouted through a microphone at the ruins of a house destroyed in an Israeli air strike last month that killed 12 civilians, including 4 children.
Yellow Fatah flags fluttered alongside the Hamas colors on some streets and a senior figure from the movement was one of the first to greet Mashaal as he entered the enclave.
But reconciliation is easier said than done.
While Hamas promotes armed resistance against Israel, Fatah says it wants a negotiated deal. Equally problematic, both are embedded in their power bases, with their own security forces that they do not want to give up.
"Certainly we want unity and without it we will remain weak, but we should rely on our guns until Abu Mazen (Abbas) and Fatah decide to join hands with us," said Hussein Abu Suhaib, 30, sporting a long beard and a wearing a green Hamas cap.
GAZA CITY (Reuters) -- Policemen kissed him, crowds mobbed him and gunfire rattled out in celebration as Hamas leader Khalid Mashaal made his first ever visit to the Gaza Strip.