An overwhelming majority of Danes, almost 67%, have voted in favour of joining the EU's common defence policy 30 years after opting out.

This is what results are showing with 97% of ballots counted.

"Tonight Denmark has sent a very important signal. To our allies in Europe and NATO, and to (Russian President Vladimir) Putin," Danish Prime Minister Mette Frederiksen told cheering supporters.

"We're showing, that when Putin invades a free country and threatens the stability in Europe, we others pull together."

Denmark is now set to reverse its three decades-long policy of staying out of the European Union's common defence policy (CSDP).

The vote was called by the Social Democrats-led government, just two weeks after Russia's invasion of Ukraine, meaning the war has been the major factor at the heart of this campaign.

"If there had not been such a war, this question would never have come up," says political analyst Svenning Dalgaard, a former International affairs editor with DR and TV2 in Denmark.

Marlene Wind, Professor of European Politics and Law at the University of Copenhagen, agrees.

She says the question being put to the people is about a unified European response in the face of Russian aggression and that the Danish government has been framing the campaign for a "yes" vote with the question: "Why not be at the table and have influence instead of sitting outside? No one wants to listen to us if we sit outside."

She adds: "What signal does it send to Putin if we decide to stay outside? It's not a very good signal to send to him that we are not united in Europe, and I think that really appeals to the Danes."

The Danish 'yes' to EU defence cooperation changes fundamentally our attitude to the EU," said Danish political analyst and former international editor Svenning Dalgaard.

The chronic self-doubt and the belief, that Danes deep down basically do not trust the EU, is over."

He said the Conservative Berlingske Tidende's carried the headline: "Landslide victory YES" on its front page.

Dispute the clear "yes" vote, he said this was the lowest participation in any Danish referendum to date.

But it is a clear win for the government which is now expected to call an election by the autumn, on the basis of this demonstration of support.

Meanwhile, he said the Danish People's Party, Dansk Folkeparti "is in deep crisis and is now looking at polls giving it only 4% of the vote."

He said Denmark’s first moves in supporting the EU’s Common defence are likely to include sending troops to EUFOR, the EU-led peacekeeping force in Bosnia, as well as possibly helping the Frontex force in the Mediterranean.

Denmark's Prime Minister Mette Frederiksen

Denmark is the only country in the EU to have negotiated a defence opt-out when it comes to EU policy, although Malta also remains de facto outside.

It has been granted four exceptions to the Maastricht Treaty, the founding treaty of the EU.

As well as the opt-out on defence, the other exemptions concerned the monetary union, citizenship and judicial affairs.

Turnout a key factor for the 'no' side

Despite the broad agreement among some of the key political parties, Denmark has a long history of voting "no" when it comes to EU affairs.

Most recently, in December 2015, Danes voted against strengthening their cooperation with the EU on police and security matters, for fear of losing their sovereignty over immigration.

Those campaigning for a "no" vote were split between the far-right and the far-left in Danish politics.

On the right, the Danish People’s Party was fully behind the no campaign, seeing it as a chance to irk the current government, whilst The New Right was also calling on its supporters to reject plans to align more closely with the EU.

The far-left Unity List, was anything but united on this issue.

"There has been an interesting debate going on, on the left-wing because traditionally they have been against the European Union, they have been against NATO," Mr Dalgaard says.

"One of the reasons the left-wing doesn’t really know, one way or the other, is they are supporting the Social Democratic government and they are afraid of having a problem in the next elections, if they really create a defeat for the government. The New Right now feels they can take over this subject from the left."

Placards reading 'Vote NO to more EU' and 'Freedom and security, Vote YES' seen in Randers, Denmark

Not an argument over neutrality

With a population of 5.8 million people, Denmark is not dissimilar in size to Ireland, but as a founding member of NATO, it holds very different views on neutrality and military involvement abroad.

It has already sent many lethal weapons into the war in Ukraine including US-made Harpoon anti-ship missiles.

The Harpoon shore-to-ship missiles are expected to operate alongside Ukrainian Neptune missiles, defending the Black Sea coastline, including the key southern port of Odesa.

"There has been rather big support for a very activist foreign policy in Denmark," says Marlene Wind, with the country always eager to take part in NATO and UN missions around the world.

Mr Dalgaard also agrees that there has been little debate in Denmark around the issue of arming Ukraine, and the country's prime minister has already announced plans to increase defence spending to 2% of GDP in line with NATO membership requirements, by 2033.

"No, it is not at all an issue," he says.

"There has been a discussion of how much money do we have, up until now I saw a figure saying we have supported Ukraine with about $500 million, so that’s quite a lot of money for a small country."

He says there has been an ongoing discussion for the last five or six years about whether to increase Danish defence expenditure to 2% of GDP.

"At the moment it's a bit more than one per cent, so we really have to spend a lot more on defence. Economy-wise it's a bit of a squeeze, but there’s nobody saying we shouldn’t send weapons to Ukraine.

"Everybody is trying to show that they are willing to do just about anything to show their solidarity with Ukraine."

Morten Messerschmidt (R) and British politician and former brigadier Geoffrey Van Orden in Copenhagen

The influence of neighbouring countries

Germany's plans to spend €100bn on its armed forces over the coming years, reversing decades of a declining spend on defence, also played a key role in the Danish government’s decision to hold this referendum.

The subsequent decisions by Sweden and Finland to join NATO, a departure from their long-standing policy of neutrality, is also believed to have strengthened the case for a "yes" vote among Danish voters.

"Denmark is very close to Germany, and we are rather small, so what happens there is quite important," explains Ms Wind.

"It really woke the Danes up to thinking… if the Germans change their minds, it really must be serious, and will we then prefer to be outside alone?"

"Denmark is very happy that Sweden and Finland will finally join NATO," Mr Dalgaard said.

"We have around 800 troops in Estonia, we also have military in Latvia and planes patrolling in the Baltic constantly with Poland, so this is a very important question. There is a lot of fear that the war could expand, and Russia would attack the Baltic states."

One of the main arguments for the "no" side was that the emergence of a joint European defence would come at the expense of NATO, which has been the cornerstone of Denmark's defence since its creation in 1949.

Mai Villadsen of The Red-Green Alliancehands out flyers during her party's 'No' campaign in Copenhagen

What happens next?

It remains to be seen whether the vote will mean that Denmark moves closer to the heart of the European Union.

The Danish government has already promised that should the EU seek to establish a supranational army, there would be yet another referendum to decide whether Denmark would participate.

Additional reporting AFP and Reuters.