Speaking at an event organised by Better Together St Andrews, the former prime minister told the Buchanan lecture theatre that cooperation and sharing resources are increasingly important themes across the world.

“Global problems” such as climate change “need global solutions” and it is “deceiving” to suggest countries can solve these issues on their own, he said.

Stressing that institutions such as the NHS were built on “need, not nationality”, Mr Brown said the UK practices a “unique form of interdependence” and that he “cannot think of four other nations… that pool resources and risks together” for mutual gain. Services such as organ transplants benefit from having a larger population to draw on, he said.

Mr Brown also made the economic case for Scotland remaining part of the UK, saying that North Sea oil revenues would not be sufficient to pay for welfare, pensions, education and other expenditures.

He was speaking alongside Baroness Shirley Williams, a Liberal Democrat member of the House of Lords. She told the audience that Scotland and the rest of the UK have “common values” and that “Scotland has for a very long time punched above its weight”, but warned of a “balkanised” future in which the country’s leadership in areas such as education and science could not continue.

Both speakers conceded that there should be more devolution, but urged Scotland not to “break all constitutional and political links” and “give up” on the UK. Mr Brown said: “You don’t have to stand up for your distinct identities at the expense of cooperating with other people.”

The event was chaired by Chloe Hill, the president of the Students’ Association, and concluded with a brief speech from Brian Thomson, a Labour member of Fife Council.

David Patterson, a student event organiser for Better Together, said: “It was a fantastic opportunity to hear first hand from a Scottish former prime minister why we’re better together. Shirley Williams spoke eloquently about what it means to be a citizen of the UK. I left with a real sense of how interdependent the UK is.”