LONDON (Reuters) - Foreign Secretary Boris Johnson reaffirmed Britain's commitment to Gibraltar on Saturday and said it would fully involve the territory in its discussions with the European Union following last month's vote to leave the bloc.

Johnson told Chief Minister Fabian Picardo in talks in London that Britain would never agree to the people of Gibraltar being transferred to the sovereignty of another state against their wishes, the Foreign Office said in a statement.

Last month acting Spanish foreign minister Jose Manuel Garcia-Margallo said Spain would seek to jointly govern Gibraltar with Britain following the Brexit vote.

The peninsula on Spain's south coast, a British territory since 1713 known to its 30,000 residents as "the Rock", is a major point of contention in Anglo-Spanish relations. Spain has long claimed sovereignty over the enclave.

Johnson said in a statement: "The people of Gibraltar have repeatedly and overwhelmingly expressed their wish to remain under British sovereignty and we will respect their wishes.

"We will never enter into arrangements under which the people of Gibraltar would pass under the sovereignty of another state against their wishes.

He added: "Furthermore the UK will not enter into any process of sovereignty negotiations with which Gibraltar is not content. We will continue to take whatever action is necessary to safeguard Gibraltar, its people and its economy including maintaining a well-functioning Gibraltar-Spain border."

Garcia-Margallo had said the Brexit vote opened up new possibilities for Spain not seen for a long time and that he hoped the prospect of the Spanish flag flying on the Rock was much closer than before.

Co-sovereignty with Spain was rejected by around 99 percent of Gibraltarians in a referendum in 2002.

The majority of people living in Gibraltar -- designated as a British Overseas Territory -- are British citizens with British passports, although thousands of Spaniards cross from mainland Spain every day for work.

Gibraltarians voted overwhelmingly in favor of Britain remaining in the European Union but were outnumbered in the referendum.

Garcia-Margallo said Spain would push to keep Gibraltar out of any general Brexit negotiations between Britain and the European Union.

But Johnson told Picardo on Saturday it would indeed form part of discussions.

"I reassured him of both our steadfast commitment to Gibraltar and our intention to fully involve Gibraltar in discussions on our future relationship with the EU," he said.

Britain rejects any notion of Spanish sovereignty against the wishes of the people of Gibraltar, one of the most prosperous regions in Europe with a thriving economy based on financial services, tourism and Internet gambling.

Gibraltar has complained in the past about excessive border controls on the Spanish side. Disputes have also broken out between Spain and Britain over fishing in waters around the Rock.

(Reporting by Stephen Addison; Editing by Catherine Evans)