A former top government law official has said that NSA whistleblower Edward Snowden performed a “public service” by triggering a debate over surveillance techniques.

Yet Eric Holder, a former US Attorney General said he believed Mr Snowden should still be punished for leaking classified intelligence information that he claimed threatened US national security.

“We can certainly argue about the way in which Snowden did what he did, but I think that he actually performed a public service by raising the debate that we engaged in and by the changes that we made,” Mr Holder told David Axelrod on a podcast produced by CNN and the University of Chicago Institute of Politics.

“Now I would say that doing what he did, and the way he did it, was inappropriate and illegal. He harmed American interests.”

Mr Holder, who led the Justice Department between 2009 to 2015 when Mr Snowden leaked the information to several newspapers, said he knew of several ways in which the US was damaged. Mr Snowden and the newspapers that published his leaks in 2013 onwards, have always denied this.

“I know there are ways in which certain of our agents were put at risk, relationships with other countries were harmed, our ability to keep the American people safe was compromised,” he said.

“There were all kinds of re-dos that had to be put in place as a result of what he did, and while those things were being done we were blind in certain really critical areas. So what he did was not without consequence.”

Mr Snowden, who has spent the last few years in exile in Russia, should return to the US to deal with the consequences, Mr Holder claimed.

“I think that he's got to make a decision. He’s broken the law in my view. He needs to get lawyers, come on back, and decide, see what he wants to do,” he said.

“But, I think in deciding what an appropriate sentence should be, I think a judge could take into account the usefulness of having had that national debate.”

At a University of Chicago Institute of Politics event earlier this month, Mr Snowden, appearing via videoconference, said he would return to the US if he could receive a fair trial.

“I’ve already said from the very first moment that if the government was willing to provide a fair trial, if I had access to public interest defences and other things like that, I would want to come home and make my case to the jury,” he told University of Chicago Law professor. Geoffrey Stone.

“But, as I think you’re quite familiar, the Espionage Act does not permit a public interest defence. You're not allowed to speak the word “whistleblower” at trial.”

Mr Holder, the country’s first African-American attorney general, also accused presumptive Republican nominee Donald Trump of playing the race card in his campaign.

“I don’t think there's any question about that,” he said. “The fact that he questioned the legitimacy of President Obama by questioning where he was born, what he’s said about Mexicans. I think there’s a race-based component to his campaign. I think he appeals too often to the worst side of us as Americans.”