It is stated in this article that:
Spain ceded Gibraltar to Britain in perpetuity in the treaty of Utrecht in 1713.
This point of view appears to be UK policy, as in:
... the prime minster’s official spokesman said. “Gibraltar is a full part of the UK family and has a mature and modern constitutional relationship with the UK."
Spain however, seems to hold the position that
... Gibraltar was disputed and on a UN list of “non-self-governing territories … subject to decolonisation”.
What is the basis of this difference of understanding?
Note - I am not asking about this specific news article - just citing as an example of this disagreement. Since its a UK-based source, maybe there is a possibility of bias in it; but I am not endorsing a point of view by citing it. If I spoke Spanish, maybe I'd have chosen differently.