Terrorists and child sex rings could be uncovered through their internet discussions as part of a tough set of security measures to be unveiled by Home Secretary Theresa May this week.

Major online service providers, such as Google, will be legally obliged to retain a log of users and the mobile phones or computers they have accessed in case police and security agencies later need the information to help them locate criminals. This measure will be included in the Counter-terrorism and Security Bill that is being introduced in the wake of Isis’s beheadings of prisoners, including British aid workers David Haines and Alan Henning, this year

Internet Protocol (IP) addresses are assigned to all devices, but are often temporary and the records on them patchy. Forcing firms to maintain a log of IP addresses and who used them will help police trace terror suspects who hatch their plans through the internet, as well as cyber bullies and members of organised crime gangs.

“The Bill provides the opportunity to resolve the very real problems that exist around IP resolution and is a step in the right direction towards bridging the overall communications data capability gap,” said Ms May.

However, the Home Secretary is keen to go further and allow security services to access every website that people visit through a Data Communications Bill, which she argued was “a matter of national security”. The Liberal Democrats blocked plans for what they derided as a “snooper’s charter” last year.

The party risked inflaming the row last night, arguing that the IP matching plans have only come about because Nick Clegg had consistently asked for the policy to be implemented rather than more “illiberal” ideas.

A Lib Dem spokesman said that the plan had only been introduced after months of Conservative “foot dragging” on the issue, adding that the Snooper’s Charter is “dead and buried” as long as the party is in Coalition Government. He said: “They [the Conservatives] always bang on about new security powers but have done nothing about IP addresses since we called for it in spring 2013.”

Earlier this month, David Cameron announced that the Bill will include measures to ensure that major online firms publish a public reporting button so that internet users can flag up terrorist material, similar to the system used to identify child exploitation online. Addressing the Australian Parliament before last weekend’s G20 meeting in Brisbane, Mr Cameron added that it was internet companies’ “social responsibility” to tear down extremist material, such as images of beheadings and recruitment videos.

The Bill will also include a highly controversial plan to refuse entry to the UK to British jihadists who have fought in Syria and Iraq and are looking to return home unless they agree to comply to set conditions. If they refused, they would be barred for at least two years in a move that critics claim would leave them state-less and could even be illegal under international law.