Hamadoun Toure, head of the United Nations telecommunication agency, made the comments a week after the Flame cyberattack, which appeared to have sought to steal technical documents from Iran, was uncovered.
Toure, of the U.N. International Telecommunications Union, said the organization had been following the Flame threat since May.
He did not consider Flame to be an act of cyberwar, he said.
"It hasn't reached that level yet as it has been detected in time," Toure told the BBC.
He declined to suggest any particular source of the attack, but noted its sophistication.
"All indications are that Flame has been created by a nation state, that's clear," he said.
"The ITU is not mandated to make a judgment on who is responsible. Our role is to work with partners to promote better co-operation."
U.N. member nations should cooperate to defend themselves against emerging cyberthreats, he said.
"There is a risk of cyberwar -- but it's not necessary. That's what we're trying to do: prevent. We're saying the best way to win a war is to avoid it in the first place."
Swim Week Miami Beach 2014 [PHOTOS]