The man has appealed against the sentence.
Also sentenced with conditional deportation, the man was found guilty of making and possessing a bomb, prosecutor Lars Petersen of East Jutland Police told news agency Ritzau.
The man, who is a Somali citizen, was on trial at Aarhus District Court.
Evidence against him included fingerprints and DNA trails, reports Ritzau.
The bomb was discovered in October 2016 by a neighbour on residential street Peter Fabers Vej in northwest Aarhus.
The resident, who was woken by the sound of the door to a basement being kicked in, alerted police.
An extended area in the streets adjacent to the apartment building was cordoned off and residents – including The Local reporter Michael Barrett – were evacuated from two buildings.
An armed police and a bomb disposal unit were dispatched to the scene, making contact with the then-24-year-old man who did not initially leave the premises.
Police were then seen entering the building and a smoke grenade and shouts were heard before the man was detained and brought out of the first-floor apartment.
According to the prosecutor’s report, the bomb consisted of explosive elements with a spark plug and detonator and various other metal elements.
“The court took seriously the fact that his fingerprints were on the bag containing the bomb and that his DNA was on the kitchen roll,” Petersen told Ritzau, referring to the piece of kitchen roll that was wrapped around the fuse of the bomb.
The man denies his guilt and has appealed to the High Court (Vestre Landsret), his defence lawyer Lars Henriksen told Ritzau.
“We have appealed against the verdict because we disagree with the assessment of the evidence. Other fingerprints and DNA were also found on the object,” Henriksen said.
“It [the explosive material, ed.] was not found in the hands of the man, but left in a basement,” he added.