Rory McIlroy has revealed how an autograph snub from former Manchester United and Celtic ace Roy Keane fuelled his desire to inspire the next generation.

McIlroy, who is competing on Scottish soil this week in the lucrative Alfred Dunhill Links Championship at St Andrews, Carnoustie and Kingsbarns, remains a sought-after figure for signature hunters in the galleries.

At last week’s British Masters, there was cheery footage of him handing an awe-struck young fan a golf ball as he walked off a green at Close House.

There was a time when McIlroy was the wide-eyed youngster looking for a keepsake from an idol but the four-time Major winner admitted his wider sense of duty was spurred by a knock back from a man he thought was a hero.

Manchester United fan McIlroy said: “Roy Keane should be one of my heroes. He was a Manchester United player. I remember I went and asked for his autograph at the Portmarnock Links Hotel when he was with the Ireland squad and he said ‘no’. I'm sure he's alright but that sort of stuck with me ever since. That's why, if a kid asks me for an autograph, I’ll always try to do it.

“It just shows what such a small thing can mean to a kid. And that kid might be inspired to go and play. It's a nice thing to be able to do. But I've had it go the other way, as well, where I've asked someone for an autograph as a kid and they didn't give it to me and I've never liked them since.”

In a topsy-turvy, injury-hindered few months, which has seen on-course frustrations tempered by the off-course happiness of marriage, 2017 has been a bittersweet year for McIlroy. He finished runner-up in the British Masters last week and the Dunhill Links is his final event before he shuts down for a three-month period of rest and rehabilitation.

McIlroy, who could have his first year without a win since 2008, added: “In a golfing sense it has not been the year I wanted but a lot of great things have happened to me off the golf course and 2017 will always be a year I remember because of that.

“So it hasn't been the year I wanted in terms of my career, but you're going to have years that just don't quite go your way.”

McIlroy headlines a field which also includes the Glasgow duo of Scott Jamieson and Marc Warren.