When Matt Grant was out busking on the streets of Edinburgh, Scotland on Tuesday, "the worst thing that could have happened happened."

The 26-year-old musician was confronted by a woman who grabbed his guitar and smashed it up, leaving him without the means to ply his trade.

Later that evening, Grant set up a crowdfunding page in the hope of raising enough money for a replacement.

He described the incident on the fundraising page, saying: "Often I don't rise to people coming up and talking nonsense but this lady was pushing it too far. She was in my face swearing and shouting at me. I told her to go away and she wasn't having any of it. She grabbed my guitar and smashed it over the ground."

What happened next, however, was a much nicer surprise.

By the following day Grant had raised £4,000 (around US$5,200) -- more than enough for the guitar, as well as other pieces of kit he planned to replace.

But when he arrived at music store guitarguitar, the staff had a message for him. They had received a call from a "third party," who was trying to track Grant down to buy him a new guitar.

Much to Grant's surprise, the benefactor turned out to be none other than "Seven Nation Army" singer Jack White.

The singer-songwriter, who was half of rock duo The White Stripes until 2011, heard about Grant's plight and asked his management to try to find him -- which they did by ringing around the guitar shops in the Scottish capital.

Updating his GoFundMe page on Wednesday, Grant wrote: "Incredible. Jack White from The White Stripes got in touch this morning and decided to buy me a brand new guitar. Unbelievable. From one of the worst things to happen to one of the best. Once again, thank you for everyone's help."

When Grant arrived at guitarguitar to collect his new acoustic instrument, he was put in touch with the singer's manager.

He later took to Instagram with a video of himself busking again on Edinburgh's streets -- playing "Seven Nation Army."

He wrote: "This morning I came into @guitarguitaredinburgh to pick up the new acoustic. Next thing I know I'm on the phone to @officialjackwhitelive 's manager who tells me Jack White has seen my go fund me page, feels bad for what happened and wants to buy me a new guitar.

"Flashforward one kid in a candy shop later testing as many guitars as possible and I settle on a #custommade #fenderstratocaster.

"Absolute once in a million lifetimes thing happened today and I cannot thank Jack enough for his absolute generosity. Apparently he saw what happened and hit up his manager just this morning, who then amazingly tracked me down to the guitar shop just in time for me to walk out with this absolute beauty.

"Thanks Jack. I'd love to thank you personally one day, you're a legend."

Chris Cunningham, a manager at guitarguitar, told CNN: "On the morning that Matt came into the store we received a call from a third party suggesting somebody wanted to buy a guitar for Matt as a gift. They had been phoning around the Edinburgh music stores looking for him. Matt was over the moon."

Jon Wilkinson, White's UK publicist, confirmed to CNN that the guitar was bought by his client but would not comment further.

CNN has reached out to Grant for comment.

The episode follows a spate of celebrity benevolence in recent weeks. Over the summer, "Gladiator" actor Russell Crowe donated almost £3,000 ($3,870) to pay a struggling British student's drama school fees.

A week earlier, Taylor Swift gave $30,000 to a London high school student who could not afford to take up her university place to study maths.