Three-month extension' for Scotland's coastguard tugs
Emergency tugs - which can go to the aid of ships in trouble in Scottish waters - will remain in service for at least another three months.
Alistair Carmichael, Lib Dem MP for Shetland and Orkney, said the two boats would remain until the end of the year.
The contract for the emergency vessels, based in the Minch and Shetland, was due to end at midnight.
A Scotland Office spokesman said the UK government believed it was worth a final attempt to find a solution.
He said the Scotland Office would lead the effort.
It is understood the UK government found £3m to provide interim funding for the emergency towing vessels.
The two tugs are thought to have been withdrawn from service but funding has been found for a short-term replacement, which may involve either or both vessels.
One of the two tugs - the Anglian Sovereign - arrived in Aberdeen earlier this week for a refit.
The Maritime and Coastguard Agency hire the tugs from shipping company JP Knight.
The UK government had proposed ending the contract, saying the safety of vessels and salvage operations was the responsibility of the commercial shipping industry.
Withdrawing the Anglian Sovereign and the Stornoway-based Anglian Prince along with two vessels covering England's south east coast was expected to save £32m over four-and-a-half years, the UK government said last year.
In October 2010, the Anglian Prince went to the aid of the nuclear-powered submarine HMS Astute after it grounded off Skye.
Highland, Orkney, Shetland and Western Isles councils have been campaigning to have the emergency towing vessels kept.
Western Isles SNP MP Angus MacNeil welcomed the extension but added that Scotland could still be left in the "bizarre situation" of having no tugs over the winter.
The leader of Comhairle nan Eilean Siar (Western Isles Council), Angus Campbell, said: "It is now imperative that we work with government to secure a long-term solution that ensures the coastline of the North and West of Scotland is adequately protected in the event of an accident.
"The tugs in Stornoway and Shetland are there for a reason - to safeguard marine users and the environment in what is, arguably, some of the most dangerous waters in the world."
A spokesman for Shetland Islands Council said: "Shetland Islands Council welcomes this three-month extension which is in the interests of all communities in the Highlands and Islands."