A seven-hour rescue mission was launched after a small fish farm boat ran aground a short distance from port.
The crews of three boats, a lifeboat and a coast rescue team worked through the night to tow the Robina 3 to safety at Kirkwall Harbour in Orkney.
A lifeboat crew on a training exercise nearby were called to the aid of the work boat at 6.50pm on Thursday. According to Shetland Coastguard, the stricken vessel ran aground at Carness, a short distance from the harbour.
Rescuers took a pump to the skipper of the boat, the only crew member of the Robina 3, and the the Kirkwall Coast Rescue Team was also called into action by the coastguard to monitor the situation from the shore.
Two work boats in the area at the time, Carol Anne and Moy, stood by in support while a boat large enough to tow Robina 3 to safety arrived.
Once at the scene, the barge Orcadia had to wait until 12.30am for water levels to rise high enough to be able to carry out the manoeuvre.
The rescue was completed at 2.10am and the Robina 3 was lifted out of the water at Kirkwall Harbour on to the deck of the Orcadia.
A spokeswoman for Shetland Coastguard said: "It was a good thing that there was a lifeboat out training at the time. They were tasked to go to the vessel in trouble and put a pump on board to help and we asked the coast rescue team to have a look from land.
"Two work boats stood by and waited for the water to rise and for a larger boat to tow the casualty boat.
"At 12.30am they started to attach the tow and the Orcadia pulled the Robina 3 back into Kirkwall before lifting the smaller boat out of the water and on to the deck of the Orcadia."