Kidnapped BBC reporter Alan Johnston emerged from 16 weeks of solitary confinement in a dark room.
Johnston, who had been snatched by al-Qaida-inspired militants, said it was "fantastic" to be free.
Gaza's Hamas rulers said Johnston's release marked the beginning of a new era of law and order in the lawless coastal strip, including a crackdown on vigilante gunmen. However, they also acknowledged they would not disarm Johnston's captors, the Army of Islam, which has close ties to one of Gaza's most powerful clans.
Hamas also said Israeli soldier Gilad Shalit, kidnapped by Hamas-allied militants last year, could be freed next, provided Israel releases hundreds of Palestinian prisoners. However, Israel has balked at such demands.
At a news conference with Hamas officials, Johnston who was held in captivity far longer than any other foreigner kidnapped in Gaza described his experience as "occasionally terrifying."
"The last 16 weeks, of course, were just the very worst you can imagine of my life, like being buried alive, really, removed from the world," he said. He said
Johnston said his one lucky break was getting a radio and being able to listen to the BBC. "I began to realize the extraordinary extent of support that there was," Johnston said.
His kidnappers, headed by a man known as Abu Khaled, were "often rude and unpleasant," he said. They "did threaten my life a number of times in various ways," Johnston said.
Johnston described his captors as a small "jihadi" group focused less on the Palestinian conflict with Israel than on "getting a knife into Britain in some way," he said. In exchange for Johnston, the Army of Islam had originally demanded that Britain free a radical Islamic cleric with ties to al-Qaida.
Johnston said his kidnappers told him from the start he would not be mistreated, but that he was worried nonetheless. He said his captors initially did not seem concerned they might be tracked down by Palestinian security forces, but became increasingly worried after Hamas took control of Gaza in mid-June.
A native of Scotland who covered Gaza for three years, Johnston was snatched from a Gaza City street by gunmen on March 12.
Hamas had demanded Johnston's freedom since it violently seized control of Gaza last month, apparently hoping to curry favor with Western countries that have unanimously condemned the takeover.
Gaza's new strongman, Hamas hardliner Mahmoud Zahar, said Johnston's release marks a new era. "It is a clear message," he said. "We will not allow illegal actions against anyone. We are going to confiscate weapons in the hands of clans used for personal interests."
A spokesman for the kidnappers, Abu Khattab al-Maqdisi, said the group's weapons "will not be handed over to anyone." However, he said the kidnappers got little in return for Johnston. "The only guarantee was that Islam would spread around the world," he added.
After his release, Johnston was surrounded by armed Hamas security men and hustled to a press conference with Ismail Haniyeh, the former Palestinian prime minister who now heads the Hamas regime in Gaza. Haniyeh draped a Palestinian flag around Johnston's shoulders which he quickly removed and pinned a Palestinian flag pin on his blue blazer.
Shortly after his release, Johnston told the BBC in a telephone interview that it was "indescribably good to be out."
"It is just the most fantastic thing to be free," he said. He said he had feared hours before his release that his captors would kill him if Hamas stormed their hideout.
"I thought there was a chance that they might really kill me, that they might not let Hamas get what they came for," Johnston told the BBC.
After a breakfast of beans and felafel with Haniyeh, Johnston set out for Jerusalem in the company of British diplomats, arriving at Britain's Jerusalem consulate later in the morning and waving to a crowd of reporters waiting outside. The BBC's Jerusalem bureau was decorated with colorful balloons, and bottles of champagne were open on the newsdesk.
At the consulate, Simon Wilson, the BBC's Jerusalem bureau chief, said Johnston was "in extraordinarily good shape, but we mustn't underestimate what may happen in the next few days," adding that the reporter had been through a "very stressful situation."
Johnston had no plans to leave for Britain on Wednesday, Wilson said. A press conference was planned later in the day.
After his release in Gaza, Johnston recounted for reporters how he was chained up for 24 hours at one point, moved twice during his captivity and beaten "a bit" in the last half hour before he was released.
After getting sick because of the food early in his captivity, he said, he was given a simple diet of bread, cheese and eggs. After the first month, he was confined to an apartment where the shutters were always drawn.
"It's been basically three months since I saw the sun," he told BBC TV.
Johnston praised Hamas for winning his freedom. "If it hadn't been for that real serious Hamas pressure, that commitment to tidying up Gaza's many, many security problems, then I might have been in that room for a lot longer," he told the news conference.
Asked if he would return to Gaza, Johnston told Al-Jazeera satellite news, "After many months of kidnapping, I think I need a break."
Last week, the Army of Islam posted a video message from Johnston on an Islamic militant web site wearing an explosives belt that he said would be detonated if there were an attempt to free him. That was the second sign of life from Johnston during his captivity, the first being a brief videotape in early June.
In a statement Wednesday, British Prime Minister Gordon Brown said Johnston's release "will come as a great relief to his family and friends and all those who have worked to see him freed."
Palestinian President Mahmoud Abbas hailed Johnston's release, calling him "the Palestinian people's friend." Abbas said militias like the Army of Islam "destroy the authority of law and create a chaotic situation" and must be dismantled.
An Abbas aide, Yasser Abed Rabbo, alleged Wednesday that Hamas and the Army of Islam were allies who coordinated the reporter's kidnapping and release. "I think that this was staged by Hamas to appear as if it respects international law," Abed Rabbo said.
Abbas disbanded Haniyeh's government after Hamas' Gaza takeover and set up an emergency Cabinet in the West Bank. Hamas has not recognized that government's authority, and parallel Palestinian governments have in effect been operating in the West Bank and Gaza since mid-June.
The Abbas government has been backed by the West, while Hamas sworn to Israel's destruction and considered a terror group by Israel, the U.S. and the European Union remains internationally isolated.
Following Johnston's release, Hamas spokesman Ghazi Hamad called for renewed dialogue with Abbas "so that we can return to a normal situation."
Ahmed Yousef, an aide to Haniyeh, told Sky News that Johnston's release proved Hamas can establish law and order. "Gaza is safe, Gaza is clean, Gaza is green," Yousef said, the color a reference to Hamas' flag.
The Army of Islam, whose formerly close relations with Hamas soured earlier this year, was one of three Hamas-allied groups that captured Shalit, the Israelis soldier, more than a year ago.
At the news conference with Johnston, Haniyeh said Hamas was interested in ending Shalit's captivity through an "honorable" prisoner exchange deal.
Israeli Prime Minister Ehud Olmert congratulated Johnston on his release, saying in a statement that Israel "joins in the happiness of his family and all of Britain." Olmert also demanded Shalit's immediate release.
Turkey has found itself in a circle of countries subject to US and European sanctions. Are they dangerous for Ankara? What is Turkey going to do in response?