THREE years ago, Eric Garcetti, the Democrat mayor of Los Angeles, had a problem: America’s stance on Mexico.

The then-President Donald Trump, in a series of ignorant, chauvinistic rants, had antagonised California’s biggest trade partner and was trying, literally and rhetorically, to build a wall on the United States’ southern frontier.

That was bad for LA. The city needed to get on with its neighbours. So Garcetti’s government worked with Mexico’s foreign ministry to set up a body called MEXLA to “deepen cross-border connections”, including on science, energy, culture and sport.

America’s states and cities have always had global links but these bloomed during the four years of Trump isolationism, not least on how to tackle the climate emergency.

One relationship which has developed in recent years is between Glasgow and Pittsburgh. On one level this is just two post-industrial world cities sharing know-how on global heating. On another, these are two powerful political and civic lobbies capable of exerting domestic and international pressure to secure policy changes.

READ MORE DAVID LEASK: Salmond used by Russians 

This is not mayors and provosts, weighed down by their chains of office and heavy rubber-chicken dinners, glad-handling each other on what we reporters like to call “junkets”.

No, it is international para-diplomacy and it is largely carried out over video links.

Cities have global interests and they have global connections. So, too, do other local authorities, churches, universities, trades unions, third-sector bodies, political parties and, yes, substate nations such Flanders, Catalonia, Quebec or Scotland.

Yet, there is something about the very idea of a Scottish foreign policy that triggers some unionists. Scroll through social media and you would imagine that it is entirely illegitimate – illegal even – for SNP ministers to engage internationally. That’s reserved, goes the chorus on Twitter, every time First Minister Nicola Sturgeon so much as nibbles a Ferrero Rocher.

Bluntly, this view is the product of dead-eyed British nationalist fanaticism, not the realities of actually governing Scotland.

The Scottish statelet might not be sovereign but has had formal international connections since long before political devolution.

For example, there has been Scottish representation at the heart of the EU since the 1970s. The current Scotland Europa crypto-embassy was opened in Brussels in 1992.

The Herald: Edinburgh Zoo pandasEdinburgh Zoo pandas

Why? Because in the real world the lines between domestic and foreign policy, between devolved and reserved powers, are far more blurred than Facebook-grade patter would have you believe. Fishing is an obvious issue where Scottish authorities cannot avoid interacting with overseas ones. But the same thing applies to policing, schooling or trading.

Some of the foreign policy issues with which Scottish Governments have grappled, even indisputably within devolved competencies, are far from trivial.

Take China. Relations with the world’s biggest country – and biggest authoritarian state – are always sensitive. Even for a substate polity like Scotland.

Successive Edinburgh governments, unionist and nationalist, have embraced Confucius Institutes, the language learning hubs which put Chinese state employees, vetted and chosen by Communist authorities, on the same Scottish university campuses as Hong Kong dissidents. This is pretty controversial stuff, even if we don’t always recognise it as such.

Those pandas did not just magically materialise at Edinburgh Zoo. Such things don’t just happen: they take diplomacy; they mean having a foreign policy; they force our politicians to make uncomfortable choices, choices they sometimes get wrong.

Here is the crux: Scotland does have a foreign policy, whether you like it or not; it is just that this policy is not always very good, in theory and practice.

Again, not least with China.

Just before the last Holyrood election, Ms Sturgeon signed a memorandum of understanding with a subsidiary of a Chinese conglomerate to explore £10 billion in investment. First there was criticism, the business concerned had been blacklisted by the Norwegians for links to human rights abuses. Then there was derision. The deal’s broker, Peter Zhang of SinoFortone, it turned out, had failed to deliver on a whole series of much-vaunted investments and his only asset was a mortgaged pub in the Chilterns. The whole affair was a shambles.

So how to you prevent international mistakes like this?

It is easy to criticise the international baby steps taken by successive Scottish governments. But it takes time to develop foreign policy nous, not least on topics as complex as trade or education agreements with China.

READ MORE DAVID LEASK: The Chinese deal that went so wrong

And Scotland is building capacity, albeit slowly.

The SNP in its latest manifesto has outlined plans to grow its para-diplomacy, for more trade hubs and aid, for expanding international outreach policies first pioneered by its Labour-Liberal Democrat predecessors.

These efforts were dismissed in The Spectator magazine last week as a “preening pretence of strutting on the world stage” aimed at local, not an international audience.

That line will appeal to many of those who do not share the SNP’s aspirations to re-establish Scottish sovereignty. Fair enough. But the party really does need to reach out to other countries, to sell a prospectus for a Scotland that is a joiner, a good neighbour and a sound ally. Failing to do so will hamper its independence project.

Yet the manifesto also contained a proposal that crosses the constitutional divide, for a Scottish Council for Global Affairs, a think tank building on the international research capacity of Glasgow, Edinburgh and St Andrews universities. Labour and the Liberal Democrats also support such an initiative, expected to need an initial annual subsidy of just six figures.

READ MORE: The SNP and the Confucius Institutes

Me? I think that is peanuts to help make sure Scotland’s foreign policy, our international outreach, is well informed, whether we are in or out of the union.

There have been attempts to get this kind of enterprise off the ground before. Let’s make sure it works this time.

When America descended in to populism, para-diplomats like LA’s Mr Garcetti helped keep dialogue open, and not just with Mexico.

As Britain, too, struggles with its own version of Trumpism, with Brexit nationalism, could Scotland offer back or side channels, alternative connections to those being strained by Tory ministers? Britain’s Foreign Office should be chapping at the door of the future Council on Global Affairs.

Because sometimes, just sometimes, a Scottish view sees angles they don’t.

Our columns are a platform for writers to express their opinions. They do not necessarily represent the views of The Herald.