Spanish Premier Mariano Rajoy says he hopes Britain stays in the EU but is unhappy with British Prime Minister David Cameron's brief campaign stop in Gibraltar, which Spain claims as its territory.

Rajoy said Thursday that Spain views Gibraltar as Spanish regardless of what happens in the referendum. Spain ceded Gibraltar's sovereignty to Britain in a 1713 treaty but has persistently sought its return ever since.

Cameron is making a two-hour visit Thursday to Gibraltar to seek votes to keep Britain in the EU in the June 23 referendum.