It "isn't acceptable" that the UK cannot deport radical cleric Abu Qatada to Jordan, the home secretary has said.
Theresa May told MPs the government was "considering all legal options" open to it - including referring the case to the European Court's grand chamber.
Abu Qatada is due to be released on bail, after the European Court of Human Rights ruled he could not be deported.
The UK is still negotiating with Jordan to get assurances that will satisfy the court he can be deported.
A Downing Street spokeswoman has said it is "not the end of the road" for the case.
In a Commons statement prompted by an "urgent question" from Labour, Mrs May told MPs that Abu Qatada posed a "serious" risk to Britain's national security - and successive governments, since 2001, had tried to deport him.
The House of Lords had agreed he could be deported - but despite that, the European Court of Human Rights had ruled against his deportation, on the grounds it would violate his right to a fair trial.
"I hardly need to tell the House that the government disagrees vehemently with Strasbourg's ruling," she said.
"It is simply isn't acceptable, that after guarantees from the Jordanians about his treatment, after British courts have found that he is dangerous, after his removal has been approved by the highest courts in our land, we still cannot deport dangerous foreign nationals."
She added: "The right place for a terrorist is a prison cell. The right place for a foreign terrorist is a foreign prison cell far away from Britain."
The government was also working hard to try to get assurances from Jordan that would satisfy the European Court that Abu Qatada could be deported, she said. For Labour, shadow home secretary Yvette Cooper said the government should be "straining every sinew" on behalf of the public to deport the preacher.
"And if she can't, she should make sure that we now have the legislation and the safeguards in place to protect the public now," she added.
She accused the government of weakening counter-terrorism measures, by replacing control orders with T-Pims. She said they could only offer restrictions that were a "far cry" from the strict bail conditions on Abu Qatada, which could be revoked in three months.
Some MPs murmured "disgraceful" as Mrs May said the European court had blocked Abu Qatada's deportation - and several Conservative backbenchers suggested Britain should suspend its membership of the European Convention on Human Rights.
Tory MP Mark Pritchard said the ruling was "undermining British justice and national security". Phillip Davies said it was a "pathetic, humiliating situation" that the government found itself in.
Mrs May said the government's efforts, as the current president of the European Council, were best spent trying to reform the way the European Court worked.
She said however strict the stringent bail conditions on the preacher - "I continue to believe Qatada should remain behind bars".
On Monday, the president of the UK's Special Immigration Appeals Commission Mr Justice Mitting ruled the Islamist cleric should be freed within days, on strict bail conditions, because his deportation had been blocked by the European Court of Human Rights (EHCR).
Mr Justice Mitting gave the home secretary three months to show that British diplomats had made progress on a new deal with Jordan, after which the stringent bail conditions could be revoked.
Abu Qatada, 51, whose real name is Omar Othman, is one of the most influential Islamist clerics in Europe, supporting jihadist causes. British judges have described him as "truly dangerous".
BBC security correspondent Gordon Corera said the cleric was seen as someone who provided religious legitimacy for acts of violence; the view was that his influence is felt around the world - but he had been careful not to break any UK laws himself.
On Monday, the preacher's lawyer said his client had been held for six-and-a-half years while fighting deportation "against a background of almost nine years' detention without charges on the grounds of national security".
The cleric will be released within a week from Long Lartin prison, in Worcestershire, and taken to an address in London - which will have been pre-assessed by MI5.
Conditions include him only being allowed to leave the address for two one-hour periods a day, restrictions on who can visit him, and a ban on access to the internet or electronic communications devices.