Ishaq Ahmed fought for the Islamic State group before joining the Al-Nusra Front, Al-Qaeda's Syrian affiliate, prosecutors said.
An Oslo court found Ahmed “must be deemed to have had major involvement” in their activities and that there were no mitigating circumstances, NTB news agency said.
Prosectors said he left the southeastern town of Fredrikstad in 2013 to head for Syria.
In early 2014, after suffering a bullet wound, he crossed the Syrian border into Turkey, where he contacted the Norwegian embassy to seek help to get back home.
Photographs posted to a friend on Facebook showed him posing with weapons and in the months before his departure he carried out online research into weapons and body armour, according to the prosecution.
Ahmed said he was innocent and was only in Syria to carry out humanitarian work.
Prosecutors had sought eight years, compared with a nine-year maximum for the offence.
It is the second trial in Norway over suspected links to Islamic State militants who have seized swathes of Iraq and Syria.
The first trial in May saw three men aged between 25 and 30 receive jail sentences ranging from seven months to four years and nine months.