The US knew North Korea was behind the Sony Pictures hack because it had secretly infiltrated the country’s computer networks in 2010, according to the New York Times and Der Spiegel.

The newspapers cited US officials and leaked documents from the National Security Agency.

The New York Times said hidden software had alerted US intelligence services to North Korean hacking activity.

North Korea has consistently denied involvement in the security breach.

American investigators believe the hackers spent two months building up a map of Sony’s systems before the hack took place, the papers say.

November’s attack on the company saw the leak of sensitive documents including salary details and confidential emails between executives.

It also resulted in Sony film The Interview, a comedy about an assassination attempt on North Korean leader Kim Jong-un, being briefly shelved and then released online.