Britain has complained about the European Union calling Gibraltar a "colony" in a piece of draft legislation, highlighting how the EU is lining up behind Spain in its territorial dispute as Britain quits the bloc.

The 27 remaining member states agreed to offer Britons visa-free travel to the EU after Brexit in March, even if talks on a broader withdrawal treaty collapse, on condition that Britain offers the same terms to EU citizens visiting for up to 90 days.

But diplomats said Britain's ambassador to the EU had objected to the wording of the text; it placed the 33,000 people of Gibraltar in a different category from UK citizens – with the same travel rights - and it also spelled out Spain's claim to sovereignty over "The Rock" at the United Nations.

In particular, it stated: "Gibraltar is a colony of the British Crown. There is a controversy between Spain and the United Kingdom concerning the sovereignty over Gibraltar."

British Prime Minister Theresa May's spokesman insisted Gibraltar was not a "colony".

The port at the mouth of the Mediterranean, ceded to Britain by Spain in 1713 after a war, was a "crown colony" when Britain joined the European bloc in 1973 but London reclassified it as a "British overseas territory" in 2002.

"Gibraltar is not a colony and it is completely inappropriate to describe in this way," a British spokeswoman said. "Gibraltar is a full part of the UK family."

More Brexit stories

Listen: Brexit Republic Podcast series

The wording has, however, been used in other EU texts.

Finding in Britain's favour against Spain in a case in 2006, the European Court of Justice stated: "Gibraltar is currently a British Crown Colony. It does not form part of the United Kingdom."

Spain's claim to sovereignty makes use of UN rules on decolonisation.

Those, among other things, limit the weight given to the preferences of people living in a territory; Gibraltarians favour remaining British, despite having voted overwhelming against Brexit in the 2016 referendum.

The text agreed by the 27 governments will be discussed by the European Parliament and the EU executive in order to finalise a regulation giving Britons visa-free access.

Recalling how EU policy on Gibraltar had so far largely favoured Britain, which joined the bloc before Spain, a senior EU official told Reuters recently: "Now the table has turned.

"The Union position ... was the British position ... But with Brexit, the Union position is now the Spanish position. We will always take the side of a member against a non-member."

Spain has already secured a right of veto over whether future Brexit arrangements can apply to Gibraltar.

Prime Minister Pedro Sanchez held up an agreement on the current withdrawal treaty in November over the issue and said Spain would seek joint sovereignty after Britain leaves the EU.

Spanish sources said this week that Madrid would insist on excluding Gibraltar from all agreements between Britain and the EU once Britain has left.

There is, however, concern among other EU members that Madrid's hard line could disrupt efforts to ease Britain out of the bloc.

EU diplomats point to the territorial issue as one of those that could fray the unity the 27 have shown in negotiations up to now.