The son of a Hamas strongman, who had provided Israel's security establishment with valuable inside information for almost a decade, will not be deported from the United States, a California court ruled on Wednesday.

The U.S. Department of Homeland of Security ruled more than a year ago that Mosab Hassan Yousef should be denied asylum because he has "engaged in terrorist activity" and is a "danger to the security of the United States."

However, on Wednesday Homeland Security officials indicated they were prepared to grant Yousef asylum, thus retracting their original intention, after claiming to have received new information which shed new light on the case.

The pro-Israel think-tank EMET, who had aided Yusef in his attempts to be granted asylum, said in a statement following Wednesday's ruling that they were "enormously grateful to all those who played a part in standing with Mosab during this time, and helping the Department of Homeland Security come to understand what a grave error deporting Mosab would have been."

The 32-year-old son of one of Hamas' founders, whose story was first exposed by Haaretz earlier in the year, argued before Judge Rico Bartolomei at the San Diego court that he will be killed if he is deported because he spied on the militant group for the Shin Bet security's intelligence agency for a decade and abandoned Islam for Christianity.

"For 10 years, he fought terrorism in secret, hiding what he was doing and who he was," his attorney, Steven Seick, wrote in a court filing. "He deserves a safe place away from violence and fear."

"I will keep fighting the ideology that is behind terrorists because I know how they think," he told reporters in the parking lot. "I know that this is the real danger that is facing liberty, facing freedom, facing humanity."

The deportation hearing came four months after Yousef published memoirs that say he was one of Shin Bet's best assets and was dubbed "The Green Prince," a reference to his Hamas pedigree and the Islamists' signature green color.

The Department of Homeland of Security called Yousef a terrorist danger when it denied him asylum in February 2009. In court documents provided to The Associated Press by Yousef's attorney, the department says he "discusses his extensive involvement with Hamas in great detail" in his recent memoir.

Yousef says his intelligence work for Israel required him to do anything he could to learn about Hamas and that neither he nor Israel knew they were suspects in the suicide bombing when he gave them rides.

"Yes, while working for Israeli intelligence, I posed as a terrorist," he wrote on his blog last month. "Yes, I carried a gun. Yes, I was in terrorist meetings with Yassir Arafat, my father and other Hamas leaders. It was part of my job."

Yousef has rallied support from members of Congress and others. Former CIA Director James Woolsey calls him a "remarkable young man" who should be commended for "extraordinary heroism and courage."

Israel has not commented on Yousef's claims, though members of the Knesset Foreign Affairs and Defense Committee wrote him this month to thank him and recognize his work for Shin Bet.

His attorney said Shin Bet will not have a representative address the immigration judge, but the now-retired officer who recruited and supervised him, Gonen Ben-Itzhak, is expected to testify.

In his book, Yousef describes growing up admiring Hamas and hating Israel, leading him to buy a couple machine guns and a handgun in 1996. He said the guns didn't work and that he was arrested by Israeli forces before he killed anyone.

Yousef says he started working with Shin Bet after witnessing Hamas brutalities in prison that left him disillusioned. He gravitated toward Christianity after his release in 1997, joining a Christian study group after a chance encounter with a British tourist at the Damascus Gate in Jerusalem.

Yousef says he joined his father, Sheik Hassan Yousef, at many meetings with Palestinian leaders and reported them to Shin Bet. His father, a senior Hamas leader who is serving a six-year sentence in an Israeli prison, disowned him in March.