"We don't like that Mr Cameron is going to Gibraltar," Rajoy said, according to El Pais.
"What is at stake is whether the UK stays in the EU, or leaves the EU, and political campaigns on that issue should take place in the UK, not in Gibraltar."
With just one week to go before the referendum, and with the "Leave" camp taking the lead in the polls, Prime Minister Cameron decided to fly to the British overseas territory in southern Spain — to spur Gibraltar's 23,000 UK citizens to vote "Remain" and to address Gibraltarians' concerns about the consequences of a Brexit.
In #Gibraltar today with our Prime Minister @David_Cameron and Chief Minister @FabianPicardo. #StrongerIn
— Ashley Fox (@Ashleyfoxmep) June 16, 2016
While the residents of Gibraltar are fiercely nationalistic and fond of British traditions, they are expected to vote en masse for remaining.
Tomorrow all Gibraltarians & Gibraltar residents should be @ CASEMATES @ 5pm for a rally with speeches at 5.30pm inc @David_Cameron #BETHERE
— Fabian Picardo (@FabianPicardo) June 15, 2016
That is mainly due to fears that — if Brexit were to happen — Spain could close its borders with Gibraltar, effectively isolating the territory.
Right now — as a part of the UK and therefore, of the EU — Gibraltar has close relations with its Spanish neighbors, with over 10,000 people commuting across the border every day. Some worry that the only way to keep the border open would be accepting a joint British-Spanish rule on the territory, a perspective loathed by most Gibraltarian Britons.
Cameron's 2-hour trip is the first time a British PM visits Gibraltar since 1968 and, while largely symbolic, it is rekindling old grudges in Spain. Madrid sees Gibraltar as a colonialist relic that blemishes Spain's territorial unity.
@David_Cameron this impressive sight will greet you tomorrow — Welcome to British #Gibraltar #StongerIN pic.twitter.com/xq4Ax2EVeE
— Eric Rowbottom (@gibwheels) June 15, 2016
The Spanish government made clear its "opposition to these kind of visits [on the part of the British PM]" and ordered its ambassador in the UK, Federico Trillo, to hammer the point home.
Rajoy — who is still formally running the country after last December's inconclusive election and ahead of next week's new round of elections — said Madrid would not take any additional measure to condemn Cameron's visit.