"As the case of Alan Johnston has ended, we hope that the case of the Israeli soldier Gilad Shalit may end too in an honorable deal that would secure the release of our hero prisoners from Israeli jails," Haniyeh told a news conference in Gaza City.
Shalit was seized from an Israeli border post by militants belonging to Hamas as well as other groups, who are demanding the release of Palestinian prisoners held in Israel in exchange for the soldier's freedom.
Haniyeh said there was a possibility to for a deal if Israel used "logic and reason" to end the suffering of the Palestinian prisoners.
Earlier Wednesday morning, Alan Johnston, the BBC journalist held hostage in the Gaza Strip since March, was handed over by his captors to Hamas officials.
The 45-year-old Briton was taken into the care of officials from the Hamas movement, which seized full control of Gaza three weeks ago.
"I was released a couple of hours ago as you can imagine. Occasionally quite terrifying... Now it really is over," Johnston told BBC World from the home of Hamas leader Ismail Haniyeh in Gaza City.
At a joint press conference with Haniyeh in Gaza City, Johnston said that his kidnappers "did threaten my life a number of times in various ways."
Johnston recounted how he was chained up for 24 hours at one point, moved twice during his captivity and hit a bit in the last half hour before he was released.
The journalist told BBC World earlier "I am hugely grateful to the people who worked [for the release]. I think I am OK. Keeping my mind in the right place was a constant battle."
Johnston, the only Western correspondent working full-time in the Strip, went missing on March 12.
"I dreamt many times of being free and always woke up back in that room ... It's an amazing thing to be free," he said, sounding composed though somewhat tired.
Johnston said he had followed events on a radio during most of his time as a hostage and thanked people around the world, as well as his colleagues at the British public broadcaster, for their support and efforts to help secure his release.
He said he had spoken briefly to his family in Scotland.
Alan's parents, Graham and Margaret Johnston and sister Catriona, said they were overjoyed by the news that he was free.
The last 114 days have been a dreadful time for us but particularly for Alan.
"Through it all, we never lost hope," the family said in a statement issued by the BBC.
Damascus-based Hamas political leader Khaled Meshal said Wednesday the freeing of the BBC journalist showed his movement had brought order to the Gaza Strip by seizing power in the territory last month.
"We have been able to close this chapter which has harmed the image of our people greatly. The efforts by Hamas have produced the freedom of Alan Johnston," Meshal told Reuters by telephone from Syria.
Referring to his secular Palestinian rivals Fatah, he said: "It showed the difference between the era in which a group used to encourage and commit security anarchy and chaos and the current situation in which Hamas is seeking to stabilize security."
Hamas forces routed those of Fatah, led by Palestinian Authority Chairman Mahmoud Abbas, to take full control of Gaza last month.
Once they had kidnappedJohnston, the captors declared themselves to be the Army of Islam, an al Qaida-inspired group with links to one of Gaza's powerful clans.
They issued Web videos showing Johnston and seeking the release of Islamists held prisoner by Britain and other states.
Most recently, after Hamas officials threatened to free him by force from the clan's stronghold, Johnston was shown wearing an explosives belt with the warning he would die if attempts were made to free him by force.
In London, no immediate comment was available from the BBC or the British Foreign Office.
Hamas, Army of Islam swap hostages in Alan Johnston deal
Hamas said Monday that its forces had launched an operation aimed at freeing the abducted reporter.
"The clocks have begun ticking toward the release of Alan Johnston," said Hamas spokesman Ghazi Hamad. "The operation of the Interior Ministry Executive Forces has started, and they are tightening the siege on the people involved in his kidnap."
Hamas sources said earlier a Palestinian civilian was killed in an exchange of fire with the group holding Johnston in the Gaza Strip.
No other casualties were reported in the fighting, which came after Hamas gunmen took up positions around the Army of Islam's stronghold, stepping up the pressure on the group to release the correspondent. Hamas blamed Army of Islam for the civilian's death.
Members of Hamas' 6,000-strong militia moved onto rooftops of high-rise buildings and deployed gunmen in streets in the Gaza City neighborhood inhabited by the Doghmush clan. The large, heavily armed family leads the Army of Islam, a little known group that had been holding Johnston for nearly four months.
Late Tuesday, the Doghmush clan released nine students loyal to Hamas that they kidnapped earlier in the week. Hamas officials and mediators said the release was meant to pave the way for Johnston's release. However, they did not know if or when Johnston would be released.
Then four Army of Islam members were freed by Hamas, said Abu Mujahid from the Popular Resistance Committees, the militant group handling the negotiations.
Hamas spokesman Khaled Abu Hilal said Tuesday that the group would not spare any efforts to free the captive BBC reporter.
Hamas radio also broadcast a toll-free phone number, urging people to call in any information about the case. Witnesses said at least four members of the Doghmush clan were detained by Hamas.
Hamas spokesman Fawzi Barhoum accused Johnston's captors of smearing the Palestinian people's reputation and of seeking to prove to the world that "we are a group of militias that fight each other to gain personal ends."
Since seizing control of Gaza last month, Hamas has demanded Johnston's release in an apparent bid to gain favor with the West.
On Monday, Hamas arrested the spokesman of the Army of Islam, giving it a potentially valuable bargaining chip in its efforts to release Johnston.
Johnston has been held far longer than any Western journalist abducted in Gaza. Hamas has said it knows where to find him, but has not raided the hideout for fear he will come to harm.
Last week, the Army of Islam posted a video message from Johnston on a militant Web site in which he appeared to be wearing an explosives belt that he said his captors would detonate if there was an attempt to free him.
The same group was involved in the capture of Israel Defense Forces Cpl. Gilad Shalit, who was seized more than a year ago in a raid on an Israeli army post near Gaza.