Amir Ardebili broke down in tears and begged for mercy during the sentencing.
It's a case that has added to the severly strained relations between Iran and the U.S.
Ardebili's lawyer described him as a small cog.
Surveillance video shows Ardibili meeting with undercover agents in the former Soviet Republic of Georgia.
The government says he was there to buy sensitive military components. He was targeted by federal agents working out of the U.S. Customs House in Philadelphia.
Ardebili is heard on tape saying that Iran was preparing for war with the U.S.
In court he choked back tears as he told the judge he was simply a procurment agent for the Iranian government, not an international arms dealer.
"He doesn't seem that important to me, and I've really been surprised by how the government's reacted about this," said defense attorney Dan Lyons.
Security was extremely tight around the federal building, with two blocks barricaded.
The U.S. Marshal says there had been death threats.
Ardibili's lawyer says it will be unsafe for him to return to Iran when he gets out of jail, because Ardibili's laptop is providing a wealth of information for U.S. agents persuing other arms dealers both here and abroad.
"We are persuing leads from the laptop and there have been a number of investigations initiated. There is nothing unsealed that we can talk about beyond that," said Assistant U.S. Attorney David Hall.
Ardibili had been facing a possible sentence of 12 to 14 years. Instead the judge gave him just five years with credit for the two years he's already been in custody.
With time off for good behavior, Ardibili could be a free man in less than two years. But, his lawyer says he will be a man without a country, unable to return to his family in Iran because he will be suspected of cooperating with U.S. Authorities.