The photographs captured the grinning grooms and a red-headed Rowling posing outside of the stunning 5-star hotel.

The author is believed to have been at the hotel for a Sunday lunch – which costs £29 for three courses.

Photographer Matt uploaded the stunning photographs on his Facebook page Matt.E.Photography. He wrote: “So we had the absolute pleasure of shooting with the super lovely John and Nick – legends in their own right – at the always elegant Prestonfield House in Edinburgh for this gorgeous wee wedding.

“Despite unpromising weather, spirits were extremely high and rightly so.

“Surrounded by an intimate group of family and friends they tied the knot in a warm, funny, beautiful humanist ceremony by local legend Caroline Pearson of the Humanist Society Scotland Ceremonies.

JK Rowling congratulating John on his marriage

“And then JK Rowling dropped into their couples session for a quick pose! Total f******* legend. I wish I could say we were cool about it.

“Not even slightly. I think she got about 20 feet before we all started screaming like big kids.”

In the photographs, JK Rowling can be seen approaching Nick and John with her arms wide open – ready to embrace the couple – as Nick and John look on in amazement.

Nick was absolutely dumbfounded by the JK Rowling’s photobomb

Rowling then hugs John as she congratulates the couple on their wedding, while Nick looks stunned in the background.

Then it’s Nick’s turn to get a hug from the awe-inspiring author.

They all then group together, with JK in the middle, and smile broadly for the camera.

As JK takes her leave Nick is seen looking at the camera in disbelief, as if he had just seen some magic.

Photographer Matt from Aberdeen said it was a surreal experience.

Speaking today, Matt said: “It was the weirdest thing. We had this lovely, very intimate and funny ceremony and I dragged them outside to take some pictures in the grounds for 10 minutes. It’s an absolutely stunning place.

“We had only taken half a dozen or so pictures when they started to bleep – like Beaker in the muppets – because they were so excited. I was a little confused and then they pointed out that JK Rowling was standing behind me.

JK Rowling with newlyweds John (left) and Nick

“I moved to go and ask her if she would be in the pictures with them, and they were like ‘No, no’, then I walked back over to them and they were like ‘No, no, go ask her’.

“So I did, and she was a superstar. She was so excited, especially when she saw that it was two guys – she’s such a big LGBT ally.

“It was such a lovely moment for the two of them, as they are big Harry Potter nerds. And so am I, after she left we were all jumping up and down screaming in excitement.”

He added: “I think she was there for a Sunday Roast, I saw her come out with an elderly woman and some young children, so it looked like a family outing.”