Spain is ready to sign a deal on the post-Brexit status of Gibraltar this week, the Spanish foreign minister has said ahead of a meeting with David Cameron.
José Manuel Albares is set to meet the new foreign secretary in Brussels on Tuesday to discuss the status of the Rock.
"Spain put on the table, several months ago, a balanced and generous agreement," Mr Albares said in an interview with Spanish TV station Telecinco.
He said he was due to fly to Brussels later on Tuesday, adding: "Spain wants this agreement to be signed tomorrow [Wednesday]."
The status of Gibraltar, an enclave at the southern tip of Spain under British rule since the 18th century, and how to police the border has been a point of contention since Britain voted to leave the EU.
At the 2016 poll 95.9% of people in Gibraltar voted to stay in the EU, by far the strongest remain vote of any area that participated in the referendum.
The enclave was excluded from the exit deal reached between Britain and the EU.
Spain, Britain and the European Union agreed on December 31, 2020, hours before Britain's full exit from the bloc, that Gibraltar would remain part of EU agreements, such as the Schengen area.
Spain has been policing the port and the airport, pending a lasting solution.
The European Commission and Spain sent Britain a proposal in late 2022, including keeping Gibraltar's land border to Spain open and ensuring the free flow of people.
But what is the history of the country? Here is what we know.
How many people live in Gibraltar and who is it governed by?
There are about 34,000 people living in Gibraltar and it is an overseas territory of the United Kingdom. It is governed in the same way as the UK, with King Charles III as the head of state.
How did Gibraltar become British?
Essentially the Rock became a British territory because a 17th century Spanish king had no children.
Its position guarding the entrance to the Mediterranean is unrivalled, so Gibraltar was for many years fought over by Spain, France and Britain, which all claimed possession.
Gibraltar has been an official British overseas territory since 1713, when it was handed to Britain under a peace treaty signed after the War of the Spanish Succession.
The fight for the territory started in 1704 when it was captured by British forces during the War of the Spanish Succession.
The War of the Spanish Succession was a European conflict fought between 1701 and 1714. The immediate cause was the death of the childless Charles II of Spain who wanted a Frenchman – Philip of Anjou – to take over in the event of his death.
His rival, Archduke Charles of Austria, was supported by other countries including Great Britain.
Britain took control in 1704, taking the land from the Spanish.
Under the Treaty of Utrecht in 1713 Gibraltar was ceded to Britain. This treaty stated “the town, castle and fortifications were to be held and enjoyed for ever without any exception or impediment whatsoever".
There were attempts by the Spanish to take possession in the coming decades but none was successful.
What was the significance of World War II?
Gibraltar’s unique position proved invaluable during World War II. Most of the civilian population were evacuated for safety, except for 4,000 people who stayed to "defend the freedom of the Rock". The territory served a vital role in both the Atlantic and the Mediterranean Seas, controlling virtually all naval traffic into and out of the Mediterranean Sea from the Atlantic Ocean.
In addition to its commanding position, Gibraltar provided a strongly defended harbour from which ships could operate in both the Atlantic and the Mediterranean, helping the UK war effort.
What do the people of Gibraltar want now?
In 1968 a referendum asked if the people of Gibraltar wanted it to remain with Britain or become part of Spain. The result was 12,762 voted to stay with Britain and only 44 voted for Spanish sovereignty. Another referendum held in 2002 also found that the vast majority of Gibraltarians wanted to remain British subjects.