David Cameron has said new laws will be needed in future to close the "safe spaces" used by suspected terrorists to communicate online with each other.
If he remains as prime minister after the election, Mr Cameron said he would push for new powers to allow the police to access details of conversations, including on mobiles and social media.
Mr Cameron said the recent attacks in Paris showed the need for such a move.
He was "comfortable" it was appropriate in a "modern liberal democracy".
Speaking at an event in the East Midlands, Mr Cameron said he recognised such powers were "very intrusive" but he believed that they were justified to counter the growing threat to the UK, as long as proper legal safeguards were in place.
The coalition introduced emergency legislation last year obliging internet and phone companies to store their customers' personal communications data for 12 months and to give access to the police.
'In extremis'Calls for these powers to be extended to include the content of e-mails, text messages and social media activity were dropped following opposition from their Liberal Democrat coalition partners.
Mr Cameron said governments had backed away from going down such a route in the past but he believed that this would have to change so that, "in extremis", such material could be obtained.
He said this would mirror existing powers enabling the police to get hold of conventional forms of communications, such as letters and other correspondence, in criminal investigations if legally sanctioned.
"The next government will have to legislate again in 2016," he said.
"If I am prime minister, I will make sure it is a comprehensive piece of legislation that makes sure we do not allow terrorist safe spaces to communicate with each other.
"That is the key principle. Do we allow terrorists the safe spaces to talk to each other? I say 'no we don't".
'First duty'Existing legislation will have to be renewed after May's general election because a "sunset clause" (which gives the law a limited time life span) was added to the Data Retention and Investigatory Powers Act last year, meaning the measures will expire in 2016
Mr Cameron, who was briefed earlier on Monday by the UK's intelligence agencies on the risk to the UK of a Paris-style attack, said the existing legal safeguards in place on data interception were among the strongest in the world.
He added: "The question is 'are we to allow a means of communication where it is simply not possible to do that'? My answer to that question is 'no we must not'.
"The first duty of any government is to keep our country and people safe. The attacks in Paris once again demonstrated the scale of the terrorist threat we face and the need to have robust powers, through our security and intelligence agencies and policing in order to keep our people safe.
"I am confident the powers we need, whether it is on communications data or the content of communications, I am very comfortable they are absolutely right for a modern liberal democracy."
Labour leader Ed Miliband said on Sunday that he would only support new powers after careful and cautious consideration, balancing the need for the security services to have the proper tools with the need for a proper system of oversight.