Ben Ainslie clinched his fourth straight gold medal to become the most decorated Olympic sailor in history.

The 35-year-old, who also won silver in 1996, overtakes Dane Paul Elvstrom, who won four golds up to 1960.

Britain's Ainslie came ninth in a tense Finn medal race to edge long-time regatta leader Jonas Hogh-Christensen of Denmark into silver.

France's Jonathan Lobert won the medal race to grab bronze from the Netherlands' Pieter-Jan Postma.

Ainslie was handed a union jack and a flare after crossing the line and sailed past the huge, cheering crowds on the Weymouth shore.

"It's times like this you are supposed to come out with something clever but I can't think of anything," said Ainslie, who won silver and gold in the Laser class before switching to the heavyweight Finn dinghy to win further Olympic titles in Athens and Beijing.

"I am speechless. I am just so glad for everyone who has supported me over the last four years. It has been an amazing Olympics.

"After six races I was in a bit of trouble. Thankfully I turned things around and got it right when it counted.

"It's been incredibly hard - there's a huge amount of pressure to perform at a home Games. It's been the hardest couple of weeks of my life but you just have to get on with the job.

"This was one of the hardest courses I have raced on and I don't want to do anything like that again."

Ainslie had trailed Hogh-Christensen all week and had not beaten the Dane until the seventh race of the regatta. He narrowed the gap to just two points on the final day of fleet racing and went into the medal race needing to finish ahead of Hogh-Christensen, and in the top six if Postma won.

Most observers expected an aggressive match-race between Ainslie and Hogh-Christensen and the Briton tracking his rival around the committee boat in the pre-start manoeuvring. Ainslie got a slow start before sailing off to the right side of the course, which he had identified as being where there was most wind.

He went around the first mark in fifth, with Postma behind him and the Dane in ninth. Ainslie climbed to second at the first downwind mark but then slipped back to join Hogh-Christensen at the back of the fleet.

Overall standings 1 Ainslie 46pts 2 Hogh-Christensen 46pts 3Lobert 49pts 4 Postma 52pts 5 Kljakovic Gaspic 55pts

But the Briton was perilously close to losing gold with Postma in third and attacking New Zealand for second. Postma, though, hit Kiwi Dan Slater's boat on the final upwind leg and had to take a penalty turn which dropped him to fifth at the finish.

Ainslie and Hogh-Christensen came home ninth and 10th and the Briton's coronation was confirmed.

"You can never say never but I don't think I can sail one of these again, it's killing my body," said Ainslie. "I don't think you will see me in Rio [for the 2016 Olympics]. But it's the best way to bow out at a home Olympics.

"I learned to sail for fun so it's been a long road but I have had a lot of support over the years and I am just so glad to have done it."