Bosses at Twitter and other social media giants face prison if they tip off their customers about spying operations by police and the security services, under a sweeping new law.

Ministers have lost patience with the tech giants after it emerged that some companies were warning users of requests for communications data by MI5, MI6 and GCHQ.

Bosses of any technology firm which ignores the Home Office edict to keep operations secret will face up to two years in prison.

Bosses at Twitter and other social media giants face prison if they tip off their customers about spying operations by police and the security services, under a sweeping new law

It will become an explicit criminal offence to notify the subject of a surveillance operation that requests for their data have been made, unless they have permission to do so. This could include tweets, text messages or emails.

The move, included in the controversial draft Investigatory Powers Bill, will further stoke tensions between the authorities and the communications companies, who officials say have become less co-operative in the wake of the Edward Snowden leaks.

Snowden – an ex-security official for the US Government, now a fugitive in Russia –revealed details of mass surveillance operations by British and American agencies.

In response, technology companies said they would take greater steps to protect their customers’ ‘privacy’.

Antony Walker, deputy chief executive officer at techUK, which represents communications and internet firms, said: ‘A right of redress by the citizen depends upon individuals being notified at some appropriate time that requests have been made to access their data.

‘By preventing companies from notifying consumers about requests for access to data the Investigatory Powers Bill risks being out of step with the direction of international law.

‘This will make co-operation between jurisdictions more difficult and could slow down the sharing of information between international agencies. So from that perspective preventing companies from being more transparent about the data requests they receive appears counter-productive.’

Details of the plan emerged in a note to the Investigatory Powers Bill, which will itself require communications firms to store details of the public’s use of the internet and apps for 12 months.

Ministers have lost patience with the tech giants after it emerged that some companies were warning users of requests for communications data by MI5, MI6 and GCHQ. Above, Thames House where the MI5 headquarters are

The note says: ‘While in many cases it would be detrimental to the investigation if a communication service provider notified the subject of an investigation that a request for their data had been made, there are cases where this would not be the case.

‘The legislation provides for communication service providers to notify the customer in such circumstances where the public authority is content for them to do so.’

In June a report by David Anderson QC, the independent reviewer of terrorism laws, warned that big internet firms were telling customers whom they knew to be under surveillance. Referring to Twitter, he said: ‘Some service providers will tip off a customer that they are under surveillance unless persuaded not to do so, typically by a court order.’

One unnamed company told Mr Anderson: ‘Our priority is our brand, not UK intelligence.’

Earlier this month, it emerged Apple has voiced concerns that the Bill would mean technology firms will have to provide the contents of communications on production of a warrant.