The "demonisation" of British spies and police should stop, the former independent reviewer of terrorism legislation has said.
Lord Carlile told BBC Radio 4's Today programme on Monday morning it was "absurd" to suggest the security services had a "casual desire to intrude into the privacy of the innocent".
On Wednesday, the home secretary will set out the Investigatory Powers Bill in parliament. The new law would permit the authorities to, among other things, look at which websites people have visited.
Theresa May has said some of the more contentious powers previously suggested have been stripped out of the Bill, including giving the police the power to look at the individual pages people had viewed rather than just the top level domain.
Defending the need for the security services to have the powers, Lord Carlile said the existing legislation needed to be "adapted for a digital age".
"We need to ensure we remain a relatively safe country in a unsafe and perilous world," he said. "I am concerned there has been quite a lot of demonisation, rather casually, of the police and security services who in reality are the unsung heroes who have kept this country safe in recent years".
The peer, who served as the independent reviewer of terrorism legislation from 2001 until 2011, also said it was "rather glib" for opponents of the new Bill to call for judges to be given greater power to authorizs action.
The Labour Party has said warrants should have to be approved by a judge rather than the home secretary.
But Lord Carlile said this was impractical as only a "handful" of judges in the country had the "real understanding" of terrorism and intelligence work necessary to be able to do that job.
May has insisted the government "will not be giving powers to go through people's browsing history".
She said: "If there are more intrusive requirements, then of course, warrants are required for those. What I am clear about is that there will be in this Bill strong oversight and authorisation arrangements," she said.
Ministers have looked at all the arguments about handing over that responsibility to independent judges and the decision will be announced on Wednesday, she added on Sunday.
The government may also be heading for another high-profile showdown in the House of Lords. Lib Dem leader Tim Farron has indicated he may oppose the Bill.
“Liberal Democrats will always support proportionate measures to increase our security, but we must not allow cornerstone civil liberties to be swept away," he told The Independent.
"We will wait with interest to see the detail of the draft Bill, as the Tories have long argued for powers that are not targeted and not proportionate. We blocked the 'snooper’s charter' in government and would strongly resist any attempt to bring it back."