Runners from more than 100 countries set off from the centre of a rain-soaked Edinburgh to take on the 26.2-mile course.
Organisers said around 30,000 people had signed up for the weekend running festival, which also included a half marathon, relay event, 10k and 5k routes and junior races over two days.
Kenya’s David Toniok, 30, raced to the finish line first to win the marathon in 2 hours, 15 minutes and 33 seconds, only 7 seconds off the course record.
Kateryna Stetsenko, 32, from Ukraine, was the fastest female finisher - crossing the finish line in Musselburgh in 2 hours, 36 minutes and 7 seconds.
The half marathon was won by Scottish runner Ross Houston, who finished in 1 hour, 7 minutes and 16 seconds.
Houston, who will compete at the Glasgow 2014 Commonwealth Games, said: “There aren’t many halfs as big as this in the UK ahead of Glasgow 2014 so this was a good choice to run in the lead up to it, especially as I live just outside Edinburgh.”
Steven Bonthone, 43, from Perth, won a race against time to complete all four adult races - running a total of 48 miles to raise funds for Macmillan Cancer Support.
He said: “I ran the 5k and 10k, half and full marathon to honour my dad’s memory who lost his battle with oesophageal cancer in July 2013. He inspired me to take up running and took me along to my first run when I was young.”
Neil Kilgour, director of the running festival, said: “From the world’s best elites through to the first time marathon runner, to youngsters standing in the start pen for the first time in their lives, we welcome them all. Each of these people are changing their lives and many are changing the lives of others too through raising vital funds for charity.”
More than 1,500 runners from the festival’s official charity - Macmillan Cancer Support - took part and together with hundreds of other charities, organisers are hoping to raise more than £4.5 million.