The operation began at the same time as a successful US-Israeli joint effort in which the Stuxnet virus was deployed to destroy a thousand or more Iranian centrifuges that were enriching uranium, Reuters reported.
For the attack against North Korea's nuclear program, Stuxnet's developers produced a related virus that would be activated when it encountered Korean-language settings on an infected machine, one US intelligence source told Reuters.
US agents, however, were unable to access the core machines that ran Pyongyang's nuclear weapons program, said another source, a former high-ranking intelligence official who was briefed on the program.
As one of the most insular countries in the world, North Korea's utter secrecy, as well as the extreme isolation of its communications systems, foiled the National Security Agency-led campaign, the official told Reuters.
North Korea's communications networks are similarly isolated. One needs police permission just to own a computer, and the open Internet is unknown except to a tiny elite. Furthermore, the country has one main conduit for Internet connections to the outside world, through China, Reuters reported.
Iran, on the other hand, engages in widespread Internet use and had interactions with companies from around the globe.
Experts who spoke with Reuters said there are similarities between North Korea and Iran's nuclear programs, and the two countries continue to collaborate on military technology. Because of that overlap, the NSA would not have had to modify Stuxnet much to make it capable of destroying centrifuges in North Korea.
Despite the subtle differences between the programs, the NSA attack was thwarted by the inability to infiltrate North Korea's program in the first place.
David Albright, founder of the Institute for Science and International Security and an authority on North Korea's nuclear program, told Reuters that US hackers probably tried to get to North Korea by compromising technology suppliers from Iran, Pakistan or China.
As for the successful attack on Iran, a leading theory is that Stuxnet was placed by a sophisticated espionage program developed by a team close to the virus' authors, known as the Equation Group.