Rory McIlroy admitted he had allowed himself to dream of Open Championship glory before Cameron Smith snatched the Claret Jug away at St Andrews.

Northern Irishman McIlroy had the bulk of the crowd support as he attempted to win a fifth major, and a first in eight years, but he could not convert a lead into victory.

Having started the day in a share of first place with Viktor Hovland, McIlroy at one stage powered into a two-stroke lead at 17 under par, yet charging Australian Smith surged past him after a run of five birdies from 10 to 14, and that was that.

McIlroy attempted to respond but found little, accepting his putter had gone cold once he completed a two-under round of 70 to reach 18 under for the championship, enough only for third place. American Cameron Young sneaked up to second, one behind Smith whose closing 64 gave him a 20-under winning score.

McIlroy said: "It's not life or death. I'll have other chances to win the Open Championship and other chances to win majors. It's one that I feel like I let slip away, but there will be other opportunities."

He had wondered how it would feel to again win The Open, having triumphed in 2014 at Royal Liverpool.

"Of course. I'm only human. I'm not a robot," the 33-year-old said.

"Of course, you think about it, and you envision it, and you want to envision it. My hotel room is directly opposite the big yellow board on 18. Every time I go out, I'm trying to envision McIlroy at the top name on that leaderboard and how did that feel?

"At the start of the day, it was at the top, but at the start of tomorrow, it won't be. Of course you have to let yourself dream. You've got to let yourself think about it and what it would be like, but once I was on the golf course, it was just the task at hand and trying to play the best golf I possibly could."

McIlroy felt he played well on Sunday until it came to capitalising on chances, particularly in the middle part of the round when many, as Smith showed, made significant gains.

"I wish that I had hit it a little closer with some approach shot shots, and I wish I'd have holed a couple more putts," he said. "The putter just went a little cold today compared to the last three days.

"I've just got to keep putting myself in position, keep putting myself in there. And whenever you put yourself in that shining light, you're going to have to deal with setbacks and deal with failures. Today is one of those times. But I just have to dust myself off and come again and keep working hard and keep believing."

He said he was "beaten by a better player this week".

"But it's been a good week overall," said the world number two. "I can't be too despondent because of how this year's going. I'm playing some of the best golf I've played in a long time. So it's just a matter of keep knocking on the door, and eventually one will open."