The four had been charged with “terror offences” for allegedly providing support for Danish-Palestinian Omar El-Hussein ahead of the second attack, which took place outside a synagogue.
Their actions were “not of such a character that the actions can lead to a conviction for complicity,” the verdict read.
The four men – Bhostan Hossein, 27, Liban Elmi, 21, Ibrahim Abbas, 23, and Mahmoud Rabea, 32 – smiled towards each other and their lawyers when the verdict was read out.
Hossein and Elmi were however convicted of a lesser charge for disposing of the weapon. Their sentence were to be announced later on Tuesday.
The prosecution said it was surprised by the acquittal.
“We are surprised that the court has judged the evidence against the accused differently than the prosecution has,” the assistant prosecutor in the case, Sidsel Klixbull, said in a statement.
Justice Minister Søren Pind wrote on Twitter that authorities would “study the verdict and see whether to appeal.”
The four risked life imprisonment if found guilty, which in Denmark means they would have been entitled to a pardoning hearing after 12 years.
Targeted free speech event
On February 14, 2015, Danish-born El-Hussein opened fire with an automatic rifle outside a cultural centre hosting a free speech event featuring Swedish cartoonist Lars Vilks.
In what is believed to have been an attempt to stop the assailant outside the centre, filmmaker Finn Nørgaard, 55, was killed and three police officers were wounded.
Later that night, El-Hussein — seemingly inspired by the attacks on French satirical weekly Charlie Hebdo — headed to the city's main synagogue, where he shot and killed 37-year-old Jewish security guard Dan Uzan.
El-Hussein, 22, was shot dead by police hours later, having killed two people and wounded five.
Question of 'intent'
The prosecution had argued that the four committed a “terror offence” by providing El-Hussein with support in the form of ammunition, a hoodie and a bag used in the second attack, and by paying for his time in an internet cafe where he located the synagogue.
The court viewed video images of El-Hussein, Elmi and Abbas in the cafe after the synagogue shooting. They were seen talking jokingly, and El-Hussein appeared to act out pulling the trigger of a weapon.
But the prosecution failed to prove the question of “intent”, meaning that the four knew about his plans to commit an act of terror, the court found.
Released from prison just two weeks before the attacks after serving time for a stabbing, El-Hussein was known for his violent temper and for having ties to a criminal gang.
The prosecution said he pledged allegiance to Islamic State group leader Abu Bakr al-Baghdadi on Facebook on the day of the shootings, but investigators said they believed he was not part of a jihadist network.
Danish intelligence agency PET has however been criticised for failing to act on information from prison services that he was at risk of radicalisation.
According to media reports the four acquitted all have criminal records for offences ranging from break-ins to possession of automatic weapons.