Campaign by attorney general, Ken Cuccinelli, to gain access to Michael Mann's material, is dismissed by state supreme court

The two-year legal pursuit of the climate scientist, Michael Mann, by Virginia's climate-sceptic attorney general ran into a dead end at the state supreme court on Friday.

The court rejected Ken Cuccinelli's demand for Mann's email, research notes, and even handwritten memos from his time at the University of Virginia, ruling that the official did not have the legal authority to demand such records.

The decision was seen as a victory for academic freedom, and a personal embarrassment for Cuccinelli, who had hoped to use his high-profile campaign against the climate scientist to raise his political profile ahead of a run for governorship.

Cuccinelli, who dismisses the existence of climate change, has spent two years pursuing Mann through the courts, demanding access to his correspondence with dozens of researchers at other institutions and to grant applications for an investigation into possible fraud.

Mann left the University of Virginia in 2005, and now works at Penn State University.

Mann said in an email that he was pleased that the legal campaign was over. But he added: "It's sad that so much money and resources had to be wasted on Cuccinelli's witch hunt against me and the University of Virginia, when it could have been invested, for example, in measures to protect Virginia's coastline from the damaging effects of sea-level rise it is already seeing."

He also noted that Cuccinelli had continued the investigation, even after the inspector general of the National Science Foundation dismissed the allegations against him.

As the author of the iconic "hockey stick graph" showing a sharp rise in warming in the 20th century, Mann has long been a target of those who deny the existence of climate change, who accuse him of manipulating data.

Such accusations multiplied after emails to and from Mann were made public as part of a batch released without authorisation from the University of East Anglia's climate research unit. Mann was cleared of wrongdoing by several investigations.

But that did not appear to make an impression on Cuccinelli, who went to court repeatedly to demand the university turn over Mann's correspondence.

His persistence was seen as an assault on academic freedom. The University of Virginia also resisted the attorney general's demands.

"We applaud the high court for reaffirming that Cuccinelli didn't have a legal leg to stand on in his pursuit of Mann's and other scientists' private correspondence," said Michael Halpern, program manager of the Union of Concerned Scientists. "Academic institutions have the responsibility to protect their faculty's ability to discover new things about our world without fearing harassment. Nobody should expect the rough drafts of their work to be subject to the same level of scrutiny as their published research."

It is not entirely clear how Cuccinelli will respond. The attorney general is planning to run for governor in 2013, and he showed no sign of regret in his response to the decision on Friday.

"From the beginning, we have said that we were simply trying to review documents that are unquestionably state property to determine whether or not fraud had been committed," his office said in a statement. "Today, the court effectively held that state agencies do not have to provide state-owned property to state investigators looking into potential fraud involving government funds."