Joseph James McElroy, 18, of Woodford Green in London, was found guilty of unauthorised modification of computer data and impairing the performance of a computer under section three of the 1990 Computer Misuse Act at Bow Street Magistrates in December.
When sentencing, Judge Goymer told McElroy that it was understandable that the US government at first thought a terrorist attempt had been made to compromise their computers.
McElroy had accessed 17 computers at the Fermi National Accelerator Laboratory in Chicago in June 2002, which contained both classified and non-classified atomic weapons and research data.
But he had only used spare storage space on the labs computers and broadband access to upload pirated movies, software and games for him and his friends to use. He had also password protected this space.
Lab staff only noticed they had been compromised when back-ups started slowing down and taking much longer than usual. An investigation involving US authorities and Scotland Yard's computer crime unit uncovered McElroy's email address and he was arrested in July last year.
The US government was claiming £21,215 in costs for the three days it took to clean and repair the hard drives, during which time vital research data was unavailable.
Judge Goymer said McElroy had no means to pay those costs as he had already accrued £3,000 in student debts in his first year at university.
But he said this should be a warning to those who think hacking into computers is a "joke" or a "hobby" and that anyone in future found guilty of such offences will face custodial sentences.
"This is a serious offence," he said. "Computers are an important feature of life in the 21st century. Government, industry, commerce and a whole variety of other industries rely on the integrity and reliability of their computers in order that their proper and legitimate activities can be carried out."
The court ordered that all the pirated software, movies and games found on McElroy's computers be destroyed.