Emergency service crews rescued two people “just in the nick of time” after their car was swept from the road and pinned to a metal gate by a torrent of floodwater.

Specialist fire crews waded into the fast-flowing water in the Scottish Borders as Storm Dennis lashed down to save the pair from the “extremely dangerous situation” after a river had burst its banks.

Photos of the rescue and its aftermath show the Volkswagen Golf in a field, perpendicular to the Newcastleton road.

The two people were taken to hospital by paramedics after being rescued from the “perilous” scenario, but have since been discharged and were able to return home.

Swift water rescue technicians from Carlisle and Dumfries attended, alongside a water first responder crew from Longtown, with Carlisle East fire station posting details of the rescue on Twitter.

“Two casualties successfully rescued from an extremely dangerous situation where their car had been swept off the road and had become wedged against a gate in a field, by a nearby river than had burst its banks near Newcastleton,” it tweeted.

Explaining how the crews “waded into the water to set up a line rescue system to lower rescuers down to the casualties”, the tweets from Saturday night added that the pair were brought back to a waiting ambulance “just in the nick of time”.

It added: “Excellent work by all crews, who are all returning back to station safety, while the casualties are transferred to hospital via ambulance.”

On Sunday morning, the account shared pictures of the scene once the storm had passed, revealing the abandoned car wedged against the metal gate.

“A couple of photos taken now that the water has receded to show just how perilous the situation was last night,” the first tweet said.

“We have been informed that both casualties have now been discharged from hospital, and are now home.”

South Scotland MSP Paul Wheelhouse tweeted his thanks to the crews involved and urged people to “Please be careful out there folks – only travel if necessary”.

Newcastleton, where the rescue took place, and Hawick in the Scottish Borders were the last remaining parts of Scotland to have severe flood warnings, issued by the Scottish Environment Protection Agency, still in force on Sunday morning – although these have since expired.

Deputy First Minister John Swinny was among MSPs expressing concerns in the “very difficult conditions” with Mr Wheelhouse adding: “This seems like it is pretty bad. Too early to say just how bad.”

It is the second time in a week storm conditions have hit the country with Hawick suffering particular damage.

A guest house and bistro collapsed into the River Teviot last Sunday, though no-one was injured.

Footage posted on social media showed a wall of the Bridge House Guest House and Sonia’s Bistro building collapsing into the fast-flowing River Teviot.

A yellow wind warning is in place for all of Scotland from 10am on Sunday until 12pm on Monday, with gusts of up to 70mph expected at times.

However according to the BBC, a gust of 77mph was recorded in South Uist, in the Outer Hebrides, on Saturday morning.

Ferry firm CalMac has already cancelled planned Sunday sailings between Fionnphort and Iona due to the warnings with other services between Ullapool and Stornoway, Oban and Castlebay, Mallaig to Lochboisdale and Oban to Lochboisdale also called off in advance.

Two Scottish Premiership matches were called off initially, with Rangers v Livingston and Motherwell v St Mirren falling foul of the conditions along with Ayr United v Greenock Morton in the Championship.

However, the game in Glasgow was rescheduled for Sunday despite warnings remaining in place – and Livingston bosses calling for the game to be played on Monday night which was rejected by the SPFL.

At 10am on Sunday, ahead of the 3pm kick-off, Rangers tweeted: “Groundstaff have been working tirelessly since 5am this morning and there are currently no concerns over the pitch ahead of today’s match against Livingston.”