BRUSSELS - EU and UK officials say that they are close to an agreement that would end three years of legal limbo for Gibraltar, but hopes of securing a deal before June’s European elections are fading following talks on Thursday.

In a joint statement following talks in Brussels, the parties said they had agreed "general political lines" on the territory's future status and said a final deal could be reached within weeks.

Foreign Secretary Lord Cameron was among those taking part in the talks about Gibraltar's relationship with the EU - which remains unresolved after the UK officially left the bloc in 2020.

The joint statement said: "Discussions took place in a constructive atmosphere, with significant progress achieved. General political lines have been agreed, including on [the] airport, goods and mobility.

"Negotiations will continue over the coming weeks to conclude the UK-EU agreement.

"The participants agreed that this was a productive day."

The narrow peninsula - known colloquially as 'The Rock' - has been a British territory since 1713, but its sovereignty has been disputed by Spain.

The question of how to police Gibraltar's border with Spain long-term has been undecided since Brexit, while another sticking point is Madrid's desire to have greater management of its airport.

Lord Cameron's Spanish counterpart Jose Manuel Albares was among those who took part in Friday's talks, alongside European Commission executive vice president Maros Sefcovic and the Chief Minister of Gibraltar Fabian Picardo.

The joint statement continued. "The meeting reaffirmed their shared commitment to concluding an UK-EU agreement to secure the future prosperity of the whole region.

"This agreement will bring confidence, legal certainty and stability to the lives and livelihoods of the people of the whole region, without prejudice to the parties' legal positions."