A kayaker whose disappearance two miles out in the Forth sparked a massive hunt swam back to shore in the dark.
A helicopter was launched to aid the search for the missing man on Wednesday afternoon in what were described as cold and difficult conditions.
At around 5am on Thursday HM Coastguard reported that the man, who was not wearing a life jacket and had abandoned his inflatable kayak, reached shore himself safe and well.
Both Kinghorn RNLI and Anstruther RNLI lifeboats joined the search, which was mounted after the man, who set out from Portobello Beach, failed to return.
Coastguard rescue teams from Fisherrow, South Queensferry and North Berwick, Police Scotland and the Coastguard search and rescue helicopter from Inverness were also involved.
A coastguard statement said: “HM Coastguard is pleased to announce that the missing kayaker was traced onshore overnight after members of the public came forward with information.
“The man involved had been forced to abandon the kayak at sea and swim back to shore in darkness and is safe and well.”
HM Coastguard had appealed to the public for help in finding the kayaker, who had been described as 30 to 40 years old.
It said it had received a report of a male overdue on an inflatable kayak at 3.15pm on Wednesday.
He was last seen at 4pm around two miles off Portobello Beach and was said to be wearing jeans and a jumper.
A Kinghorn RNLI spokesman said: “We’re very happy to hear that the kayaker we were searching for has been confirmed safe and well ashore.
“Our volunteer crew was tasked at 5.15pm on Wednesday evening and took part in a large scale search which was eventually stood down around 11pm.
“Our team was at sea for nearly five hours in cold difficult conditions.”