EU officials want to ensure the country continues to play an active part in Europol whilst also respecting the result of the December 2015 vote, in which people rebuffed more integration of security operations.

The negotiations provide a nightmare headache for eurocrats at a difficult time for the bloc, as they will be a keen not to be seen bending the rules at the same time as taking a tough stance on Schengen and Brexit.

Exasperated German MEP Birgit Sippel summed up the mood in Brussels over the last minute dash for a compromise, asking: "Why the hell was such a point put to a referendum?”

The impasse has hardened resolve amongst some Brussels politicians to crack down on opt outs from controversial EU policies which has been growing ever since Britain – typically the bloc's most belligerent member – voted to quit.

GETTY

The Danish refused to opt into measures needed to stay part of the EU police force

GETTY

Eurocrats are now scrambling to reach some form of compromise

It has arisen because Denmark opted out of a raft obligations which accompanied the creation of Schengen zone in the early 1990s alongside Britain and Ireland, although unlike the latter two it is part of the borderless system.

But due to planned changes to the way Europol works, designed to significantly beef the organisation up in the face of a heightened terror threat, the country was required by Brussels to opt back in to the measures.

However, the Danish people voted against doing so in a referendum in December 2015, meaning the country is not legally prepared to take part in the new, more integrated version of the EU police force.

The vote was seen as a punch in the nose to the European elite and a further blow to the concept of ever-closer union, and presaged a dynamite 2016 in which eurosceptic feeling swept the continent.

However, opinion polls show that Danish people do still want their country to remain part of Europol and help in the Europe-wide fight against terror, leaving Brussels scrambling to secure a compromise.

Ms Sippel sighed: “Now we are in a situation where we need to find tricky ways to make Denmark part of Europol.”

And senior EU Commission official Luigi Soreca warned: “Denmark should not become a blind spot on the EU map of law enforcement co-operation."

But eurocrats only have until May to secure some form of stitch-up on issues such as data protection and European Court of Justice jurisdiction, or face Denmark dropping out of Europol and losing access to its databases.

A further complication is that the EU Parliament, which often takes a dim view of referenda, will have to ratify any deal with some MEPs indicating they are not in the mood to cater for countries not towing the Brussels line.

BORDER-FREE Schengen: Countries you can visit WITHOUT a passport
Mon, January 23, 2017

If you are an EU national, you do not need to show your national ID card or passport when you are travelling from one border-free Schengen EU country to another. The Schengen Area is an area comprising 26 European states that have officially abolished passport and any other type of border control at their mutual borders.

Play slideshow

1 of 25

Ms Sippel blasted: “If you are a member of a club you have to accept the rules.

"But in the European Union, this is not the case. We have again and again, in different areas, opt-outs.

"I think we should rethink this way of co-operation."

Europe has been struck by a series of devastating terror attacks over the last 18 months, with atrocities being committed in Paris, Nice, Brussels and Berlin.

Eurocrats have vowed to beef up both Europol and their new border force, the European Border and Coast Guard, handing them extra powers to combat terror after some attackers exploited free movement to plan and carry out the massacres.