McIlroy and playing partner Scott Stallings had been approaching the end of their third round when a remote-controlled ball — appearing to be controlled by a spectator at the side of the green — rolled towards the flag.
Having circled the hole numerous times, the ball looked set to finally drop into the cup when it was swatted away by an outstretched McIlroy, who turned to face the pilot before blocking another run at the hole from the remote-guided ball.
There would be no third attempt as McIlroy picked up the ball before hurling it into the water guarding the green, much to the delight of the onlooking crowd.
Cheers quickly turned to boos as the intruder — making a thumbs down gesture towards nearby fans — was led away by stewards.
“He kept yelling at Rory, ‘This is my dream, this is my dream.’ I don’t know exactly what he was dreaming about, but his ball is gone.”
Stallings, who had been lining up his approach shot from a nearby bunker during the incident, added he had been ready to step in had McIlroy not taken matters into his own hands.
“I thought it was great,” the American said. “I was about to go and do the same thing.”
McIlory finished five shots behind Cantlay to tie for eighth, securing yet another top 10 finish after fifth and third place finishes at the US and British Opens respectively in recent months.
Playing the 150th edition of the event at St. Andrews, McIlroy saw one tee drive strike an ancient stone on the fairway before another inadvertently struck a spectator, breaking their hand.