Barack Obama has warned against rushing to curb civil liberties after talks with David Cameron on how to tackle the terrorist threat.
In a joint press conference at the White House, the US president said there should not be an "overreaction" to the atrocities in Paris.
He also suggested that European countries needed to make sure their Muslim populations were better "assimilated".
The comments came after a two-day visit by the Prime Minister in which he pushed for tougher requirements for internet firms to alert authorities to suspicious online exchanges, ban encrypted communications and store data.
A report last year into the murder of Fusilier Lee Rigby concluded that Facebook failed to pass on information that could have prevented his death.
The American firm had previously shut down accounts belonging to one of the killers, Michael Adebowale, because he had discussed terrorism - but did not raise concerns with the security services.
The two leaders agreed to establish a new joint group to exchange information and expertise on countering the rise of violent extremism.
Britain will also step up its support to Iraqi forces fighting Islamic State (IS) terrorists with the deployment of additional intelligence and surveillance assets.
But the premiers conceded that there was still more work to be done to find a way of ensuring suspected terrorists can be tracked without undermining civil liberties.
Mr Cameron said: "I take a very simple approach to this, which is ever since we've been sending letters to each other or making telephone calls to each other or mobile phone calls to each other or, indeed, contacting each other on the internet, it has been possible in both our countries in extremis, in my country by signed warrant by the Home Secretary, to potentially listen to a call between two terrorists, to stop them in their activity.
"In your country, a judicial process. We've had our own. We're not asking for back doors. We have - we believe in very clear front doors through legal processes that should help to keep our country safe.
"And my only argument is that as technology develops, as the world moves on, we should try to avoid the safe havens that could otherwise be created for terrorists to talk to each other.
"That's the goal that I think is so important. Because I'm in no doubt as, having been Prime Minister for four-and-a-half years, having seen how our intelligence services work, I know that some of these plots that get prevented, the lives that get saved. There is a very real connection between that and the capabilities that our intelligence services, within the law, use to defend our people."
Mr Obama, who hailed the PM as a "great friend" and "outstanding partner", said the level of threat had remained constant over the past six years of his presidency.
"I don't think that there is a situation in which because things are so much more dangerous the pendulum needs to swing," he said.
"What we have to find is a consistent framework whereby our publics have confidence that their government can both protect them but not abuse our capacity to operate in cyber space.
"Because this is all new world, as David said the laws that may have been designed for the traditional wiretap have to be updated.
"How we do that needs to be debated, both here in the US and in the UK.
"I think we're getting better at it, I think we are striking the balance better, I think that companies, here in the US at least, recognise that they have a responsibility to the public, but also want to make sure that they are meeting their responsibilities to their customers that are using their products.
"The dialogue that we are engaged in is designed to make sure that all of us feel confident that if there is an actual threat out there, our law enforcement and our intelligence officers can identify that threat and track that threat at the same time that our governments are not going around fishing into whatever text you might be sending on your smartphone. I think that can be achieved."
Mr Obama added: "It is useful to have civil libertarians and others tapping us on the shoulder in this process and reminding us that there are values at stake as well ...
"We shouldn't feel as if because we've just seen such a horrific attack in Paris, that suddenly everything should be going by the wayside.
"Unfortunately this has been a constant background and I think will continue to be for every Prime Minister or President for some time to come. We've got to make sure that we don't overreact but that we remain vigilant and are serious about our responsibilities."
Mr Obama admitted that the Edward Snowden disclosures about internet surveillance by the US government had "undermined trust".
"But we're still going to have to find ways to make sure that if an al Qaida affiliate is operating in Great Britain or in the United States, that we can try to prevent real tragedy.
"And I think the companies want to see that as well. They're patriots. They have families that they want to see protected.
"We just have to work through, in many cases what are technical issues. So it's not so much that there's a difference in intent, but how to square the circle on these issues is difficult."
The President said he thought Europe had some "particular challenges" with its Muslim communities.
"The US has one big advantage in this whole process ... our Muslim populations, they feel themselves to be Americans.
"And there is, you know, this incredible process of immigration and assimilation that is part of our tradition - that is probably our greatest strength."
But while Mr Cameron acknowledged the importance of assimilation, he said that even among groups who were well-integrated, people were being recruited by the extremists.
"You can have, tragically, people who have had all the advantages of integration, who have had all the economic opportunities our countries can offer, who still get seduced by this poisonous, radical death cult of a narrative," he said.
Mr Cameron again pressed Mr Obama to release Shaker Aamer, the last British prisoner being held at Guantanamo Bay.
National Security Council spokeswoman Bernadette Meehan said: "Prime Minister Cameron raised this case with the president, and the president told him that he understands why this case is of great interest to the Prime Minister and the British people.
"The president committed to the Prime Minister that we will prioritise this case, while making sure any action taken is consistent with our national security."
A British government source said of Mr Obama's response: "We see this as a step forward. We now need to keep working with the Americans and continue our discussions to resolve this case once and for all."
The Prime Minister also visited a memorial dedicated to civil rights leader Martin Luther King.
He said: "Martin Luther King remains a figure of truly historical significance - not just in the United States but for the world as a whole. As we mark the birthday of the great man we are reminded of his incredible life and legacy.
"His leadership in the civil rights movement, which helped shape and change an entire nation for the better, remains an inspiration to millions of people regardless their age, creed or colour.
"His words still echo in the minds of those who heard them and enthuse those born in the years that have followed. And his actions of non-violent activism - in the face of violence and intimidation - give hope to those still seeking equality and freedom. Let his dream never die."