The man has confessed to the deed and has said that he did it on behalf of people whose names he does not want to disclose.
He traveled to Denmark from Sweden in May with the task of murdering. In return, he would have a large drug debt written off.
In the district court in Helsingør, he has stated that he was pressured to take on the task and that he was provided with an apartment, money for food and an automatic weapon.
The man is sentenced for attempted murder and weapons offenses and is to be deported from Denmark, the court writes on its website.