NEW YORK - The US National Security Agency has been penetrating North Korea 's computer networks since 2010, which prompted the US to accuse North Korean government of ordering the recent cyber attack on Sony, the New York Times reported Monday.

The NSA used malware to tap into the Chinese networks that connect North Korea to the outside world and accessed the hackers' computers with the help of South Korea and other American allies, according to former US and foreign officials and newly disclosed NSA documents.

The NSA programme was able to map the internal workings of North Korea 's hackers, which totals about 6,000 people who are mostly commanded by the country's central intelligence service, the Reconnaissance General Bureau and its Bureau 121, the clandestine hacking unit.

The evidence gathered by the “early warning radar” of software painstakingly hidden to monitor North Korea’s activities proved critical in persuading President Barack Obama to accuse the government of Kim Jong-un of ordering the Sony attack, the Times said, citing the officials and experts, who spoke on the condition of anonymity about the classified N.S.A. operation.

The latest revelation raises speculation over why the American spy agency wasn't able to alert Sony when North Korea began "spear phishing," or using malicious code concealed by email to penetrate computer systems, but the attacks did not look unusual at the time, the Times reports.

Investigators have recently concluded that hackers worked from mid-September to mid-November to map out Sony's systems in a plot to bring down the network.

Sony reported the hack to the FBI on Nov. 24, just a month before The Interview was scheduled for its theatrical release. The hack, conducted by a group calling themselves the “Guardians of Peace,” severely compromised the movie studio’s internal servers, leaking the personal information of thousands of employees, including high-profile actors and directors. The group also began threatening movie theaters that planned to release The Interview, prompting Sony to cancel the film.

In early January, the United States placed new economic sanctions on North Korea in response to the hack. President Obama has said the sanctions were meant to target North Korean leaders, not the nation’s citizens.

Meanwhile, North Korea continues to insist that it had no role in cyber attack.