When Hal Morrissey Gillman arrived at the University of Edinburgh for his graduation ceremony on Wednesday, he didn't expect to see Prime Minister Justin Trudeau.

"I was surprised to see him," Mr. Morrissey Gillman said after the ceremony as he clutched his anthropology diploma. "There was no preannouncement about it."

Mr. Trudeau made the surprise visit to pick up an honorary doctorate and offer some words of wisdom to the graduating class. He talked about the 15 per cent of Canadians who have Scottish connections, he mentioned his grandfather's Scottish roots and drew laughs when he referred to his own background as a bouncer and snowboard instructor. His advice to students was to concentrate on small things such as doing good deeds and "sending your mom flowers on a day other than Mother's Day."

Story continues below advertisement

"Your actions, today and tomorrow, big and small, have an impact. So be kind. Say please and thank you. And hold the door," he said.

His star power was evident in the eyes of many students, who gave him a thunderous ovation and a round of cheers. He lapped it up and took a stroll down some city streets afterward, visiting the National Museum of Scotland and paying a visit to the Queen at Holyrood Palace. But the friendly reception he received here in Scotland will fade starting on Thursday when he heads to Hamburg and the beginning of the Group of 20 summit. That's where the hard work of dealing with issues such as trade, climate change and youth unemployment will be tackled. And that's what students at the University of Edinburgh were concerned about on Wednesday.

Mr. Morrissey Gillman has no idea what he'll do now that he has a degree. He appreciated Mr. Trudeau's uplifting message, but he has bigger things to worry about – such as finding a job.

"That's the big question," he said when asked what he plans to do now that he has a degree. Then he turned to his parents and said, "I guess I'll head home for a little bit. If that's alright, if you'll have me?"

These are uncertain times in Scotland. The economy has been struggling for the past two years even as the rest of Britain has roared ahead. Full-time jobs are scarce, the country's prospects after Brexit don't look good and the prolonged battle over Scottish independence has left the country's future uncertain.

"We're getting a picture which is fairly pessimistic about the prospects for the Scottish economy," said Stuart McIntyre, a professor of economics at the University of Strathclyde in Glasgow.

The basic numbers don't look promising. Scotland's economy shrank in the last three months of 2016 and while it rebounded sharply in the first quarter of 2017, much of the added growth came from one-off items such as a major steel mill coming back on line. And while the unemployment rate has hit a low of 4 per cent, that figure belies the fact that most of the job creation has been through self-employment and that far more people have dropped out of the work force than anywhere else in the United Kingdom. Brexit could make things worse.

Story continues below advertisement

"Brexit will be a big headwind," Prof. McIntyre said. He noted that Scotland's population is aging at a faster rate than across Britain and that Brexit is expected to restrict immigration. Brexit will be felt "most acutely in Scotland because we have a need for more migration than the rest of the U.K.," he said. Scotland's financial sector, a major part of the economy, could be hit, too, from Brexit as firms lose so-called passport privileges that allow them to set up in Britain and serve clients across the European Union.

That's the kind of message that gives pause to people such as Anna Stopford, who was celebrating her graduation on Wednesday. She welcomed Mr. Trudeau's visit to the university as well, and knew a fair bit about the Canadian Prime Minister, having studied politics and followed his fortunes online.

"It was quite honouring to have him with us today," she said. But she's also worried about the future and her job prospects. "I have no plans," she said when asked what she'll do now. "I hear a lot of doom and gloom [about the job market] and it doesn't seem like a good situation. I think if you are equipped with a good degree and enough experience, I think you'll be able to find a job. But I don't have any experience."

Brexit is troubling for students such as Nick Hawkes, who also graduated with a degree in politics on Wednesday. He enjoyed Mr. Trudeau's speech and he'd studied Canadian politics as a member of the Commonwealth youth Parliament program. But he also has no idea what he'll do now and he's concerned about looking for a job in Britain with Brexit looming.

"Brexit it is quite worrying," he said. He's hoping that the British government may soften its approach to negotiations with the EU and leave room for Britain keeping some ties to the bloc. "The world will go on and hopefully we'll keep on going," he said.

Another graduate, Jamie McDonald, said he might head to Canada because of Brexit. He studied at McGill University last year and now has a degree in international relations from Edinburgh. He voted against Brexit in last year's referendum on Britain's membership in the EU and said if he can't go to Canada, he'll stay in Scotland. His hope is that Scotland becomes independent and remains part of the EU. "I think Edinburgh is really an exciting place to be," he said.

Story continues below advertisement

As Mr. Morrissey Gillman celebrated his graduation, his mother, Jackie Morrissey, sang Mr. Trudeau's praises. She follows him on Twitter and embraces his liberal outlook. "It was so cool that he was here because he does have that kind of 'wow' celebrity status," she said.

She's optimistic about her son's future but she's well aware of the big challenges facing Scotland, including the possibility of independence. The family is divided over Scottish independence but Brexit is bringing them around to the same conclusion. Mr. Morrissey Gillman was alone in voting against independence during the 2014 referendum, but now he's changed his mind.

"I actually voted No in the first referendum for the sake of unity with the rest of Britain. But obviously the curve ball of Brexit kind of changes all that for me personally." Now, he'd vote Yes, hoping an independent Scotland would stay in the EU. "That's our future," he added.