They never did.
---
The British Empire does not exist. It collapsed in the 1930's and the members of the former British Empire were invited to join the British Commonwealth which exists to this day.
Gibraltar has chosen to remain under British Sovereignty against the wishes of the Spanish who see this as belonging to Spain. In turn, Britain has promised to protect former colonies who wish to remain under British Rule such as the Falklands, Gibraltar and many other small nation states.
Under the terms of the 1713 Treaty of Utrecht, Gibraltar was ceded to Britain in perpetuity. Spain unsuccessfully attempted to regain control in 1727 and during the Great Siege of Gibraltar which lasted from 1779 to 1783.
The capture of Gibraltar and control of Gibraltar strait by British in 1704 prevented French fleets between Mediterranean and Atlantic to combine forces.
Gibraltar.
Though Gibraltar is a British Overseas Territory, the actual Straits of Gibraltar is not 'owned' by Britain.
Britain in the sun.
Gibraltar
Gibraltar is a self governing Overseas Territory of the UK.
Yes
The Rock of Gibraltar.
Gibraltar
Gibraltar
Gibraltar
By the Treaty of Utrecht in 1713