The referendum – which had been described as so complex that it “makes the voters' eyes glaze over” – boiled down to whether Denmark should replace its current blanket opt-out of EU justice rules with the kind of model used by Britain and Ireland, which choose whether or not to participate in some areas of EU policy on a case-by-case basis.
The 'no' side was led by the anti-EU, anti-immigration Danish People's Party (DF) which argued that dropping the justice opt-out would give too much power to Brussels.
As he left a polling station in Copenhagen, pensioner Niels Engelsted said he and wife Bette had voted 'no'.
"They have packed so many things together in that proposal. They talk to the population as if we were idiots," he said.
Esben Trier, a 48-year-old consultant, said he had voted 'yes' despite "a long list" of things he didn't like about the EU.
"It's like other relationships - you have to compromise," he said.
Opponents of the referendum have argued that Denmark can negotiate a separate agreement to stay in Europol, something the ‘yes’ side argued is neither certain nor simple. Some have estimated it could take up to five years to make a parallel agreement.
DF was able to tap into fears that Denmark could be forced to accept obligatory EU refugee quotas as Europe struggles to cope with a massive influx of people fleeing conflict and poverty in the Middle East, Africa and South Asia.
Denmark has some of Europe's strictest immigration policies and has received far fewer asylum seekers this year than neighbouring Sweden or Germany.
Rasmussen's right-wing government and four other political parties – including primary opposition party the Social Democrats – said that a ’yes' vote is the best way to ensure Denmark stays in Europol, helping Danish police fight violent extremism and other cross-border crime.
It also wanted to adopt 22 EU laws on issues including cybercrime and debt recovery.
Some voters said they voted 'no' because they struggled to understand what the referendum was about.
Marlene Wind, a political science professor at the University of Copenhagen, said the 'yes' side was focusing too much on technicalities and regulations.
"Many people I've talked to say they feel completely intimidated," she told AFP.
By contrast, DF had boiled down its message on campaign posters to: "More EU? No thanks."
DF's campaign poster. Photo: Nils Meilvang/Scanpix