THIS week’s Scottish foreign direct investment figures brought to mind the simple wisdom of the Serenity Prayer, about having the courage to change the things you can, and accepting and recognising what you are unable to control.

The Scottish Government and its enterprise agencies do have significant control when it comes to attracting inward investment. And this week’s figures on foreign direct investment, published by accountancy firm Ernst & Young (EY), signal plenty of bold action on this front.

EY’s latest annual Scottish attractiveness survey shows a 51 per cent leap in the number of foreign direct investment projects secured last year to a record 119. Such a percentage leap is, on the face of it, impressive indeed. So is a 52 per cent leap in the associated number of jobs secured, to 5,385.

Taking a step back to contemplate the gloomy backdrop, the numbers are even more remarkable. They are also, in the context of the broader economic weakness, a huge relief.

It is important to recognise this economic weakness is in very large part the result of things Scotland cannot change, notably Westminster austerity and the damage being caused to the North Sea sector by weak oil prices.

The woes of the oil and gas sector have been underlined this week. Royal Dutch Shell announced a further 475 job cuts, as it restructures operations in Aberdeen, and consultancy Wood Mackenzie forecast up to 50 North Sea fields could be closed down this year.

While crude prices hit $50-a-barrrel yesterday for the first time since last autumn, the news from the North Sea remains grim. Big players in the sector are focused on cost-cutting. Many thousands of jobs have been cut so far in the North Sea, and, sadly, the smart money is on this pattern continuing for the foreseeable future.

Scottish Chambers of Commerce has been among those to highlight the significant impact of this sector’s troubles on the broader economy north of the Border. This seems to be a big factor in the performance of the economy in Scotland having fallen well below that of the UK as a whole.

And, unfortunately, the overall UK performance is lamentable enough.

The belated and unbalanced UK economic recovery looks to be in danger of stalling altogether.

Official figures yesterday confirmed UK economic growth had slowed to just 0.4 per cent in the first quarter from an already below-trend 0.6 per cent in the final three months of 2015. They also underlined the unbalanced nature of growth, with business investment falling and the UK’s international trade performance remaining dismal. Chancellor George Osborne’s vision of “a Britain carried aloft by the march of the makers” remains elusive.

Grim surveys of UK services, manufacturing and construction activity in April from the Chartered Institute of Procurement & Supply have prompted warnings from economists that growth might be running out of steam completely.

Chris Williamson, chief economist at CIPS survey compiler Markit, noted this month that, if the activity indices for these three sectors match their April readings in May and June, this would signal second-quarter gross domestic product growth of only 0.1 per cent.

Uncertainty ahead of the referendum on UK membership of the European Union, a poll promised by Prime Minister David Cameron ahead of the 2015 General Election, has been an extra factor weighing on activity in recent months.

However, we should not forget the UK’s economic weakness since 2010 has most to do with the ill-judged austerity programme put in place by Mr Osborne and his Conservative colleagues. The scale of this, and a sorry mix which has put the burden on the worst-off people who have to spend all of their money to live, has well and truly choked off growth.

Strathclyde University’s Fraser of Allander Institute is among those to have warned about the huge impact of Conservative welfare cuts on Scotland’s economy.

So we should hardly be surprised the Scottish economy grew only 0.2 per cent in the fourth quarter of 2015, having contracted by 0.1 per cent in the three months to September.

These figures are dismal. But they result from factors largely outwith Scotland’s control, in terms of failed UK economic policies, a weaker global backdrop, and a worldwide downturn in the oil and gas sector following a sharp slide in crude prices.

Returning to the sentiments of late American theologian Reinhold Niebuhr’s prayer, this makes it all the more important Scotland makes the very best of what it can control.

And this brings us back to the great inward investment figures, which, it is worth noting as an aside, signal that talk of overseas companies being put off by the continuing Scottish constitutional debate is wide of the mark.

You hear a lot of talk about how much it means to companies looking to invest in Scotland to be able to discuss their plans with very senior figures in the Scottish Government.

And taxpayer-backed Scottish Development International (SDI), the inward investment arm of the nation’s enterprise agencies, continues to play a crucial role in securing projects from overseas, with notable success in the key software sector among the encouraging details.

Clearly, Scotland has a lot to offer inward investors, notably in terms of its skills base but also through quality of life factors. However, even a great story needs to be sold.

To deliver a 51 per cent rise in inward investment project numbers, against a soft global economic backdrop and amid a downturn in a key oil and gas sector that has in the past for Scotland been the source of so many overseas projects, is really quite something.