WARNING: Some viewers may find this footage distressing.

A truck driver who was using his mobile phone when he killed a grandmother by ploughing into her car has been jailed for five years.

David Shields, 34, was caught on camera inside his cab scrolling on his device for a full 18 seconds leading up to the collision last February.

He tried to brake at the last second, but his recovery truck smashed into the back of missionary worker Yvonne Blackman's car as she queued in traffic on the A75 in Dumfries.

Footage has now been released showing Shields, from Drongan, East Ayrshire, checking his phone before noticing Ms Blackman's car at the last second.

At the High Court in Glasgow on Friday, Shields was also banned from driving for seven-and-half years after admitting causing death by dangerous driving.

Ms Blackman, from Lockerbie, Dumfries and Galloway, was on her way to meet friends when the crash took place.

The 66-year-old, a mother of four and gran to 18, died several weeks later in hospital.

Ralph Blackman, her husband of almost 38 years, spoke outside court following the sentencing.

"I think it was a reasonable deterrent for other drivers from doing a similar thing because it caused a lot of suffering," the 78-year-old said.

Visably distressed, he added: "It caused a lot of heartbreak to all of our family, grandkids, sisters, brothers and myself.

"I'm still not settled properly yet but I'm getting there, but like I said before the main thing is that justice has been done.

"Me and my family are hoping that any driver who actually uses their phone while they're driving should realise that suffering and heartbreak is caused not just to their family but the victim's family as well."

Mr Blackman added of his wife: "[She was] very fun going and she liked to get things done.

"In a lot of years she was a missionary for the JW [Jehovah's Witnesses] and she was knocking on doors trying to get people to do the right thing and serve god.

"She loved having holidays, dancing - she had a lot of life to live."

Jailing Shields, judge Lady Stacey told him: "I have seen a video of the crash and know you were paying heed to your mobile phone for 18 seconds. It was a very dangerous thing to do.

"I know you did not intent the catastrophic result, but you should have known the terrible risk you were taking."

Shields, who served as a lance corporal in the Royal Highland Fusiliers in Iraq and Afghanistan, wept as he was led away to the cells.

His defence counsel John Scullion QC earlier said: "He has asked me to apologise to Mrs Blackman's family and is ashamed of his actions that day."

The crash happened after Ms Blackman was caught in heavy traffic on the A75 Gretna to Stranraer road around 8.30am on February 8, 2017.

Shields was driving a truck for 911 Rescue Recovery from Stoke to Kilmarnock when he ploughed into the back of her Toyota Yaris.

Prosecutor Liam Ewing said: "Witnesses noted that the lorry did not appear to brake until a short distance before the collision, at which time it skidded or snaked."

The Toyota car hit a BMW in front before spinning to a halt.

Ms Blackman died in hospital on February 23 from chest and spinal injuries caused in the crash.

Shields told police he only noticed "at the last second" that the "traffic was not moving", and added: "I slammed the brakes on, slid and collided."

Analysis of the seven cameras in his truck's cab showed his "attention had been on a dash-mounted mobile telephone".

Mr Ewing said: "An analysis established he had been focusing on the phone ... therefore failing to maintain proper observations of the road ahead.

"(This was) for a period of 18 seconds prior to reacting to the presence of the car."

He is seen driving while checking the phone before his cab shudders as it hits Yvonne's car. It is not known what he was doing on the mobile at the time.

Part of the charge Shields pleaded guilty to stated he did "repeatedly interact with and focus your attention" on a phone.

David Green, head of the Scottish Fatalities Investigation Unit, said: "David Shields' dangerous driving has irrevocably damaged many lives and our thoughts go to the family of Yvonne Blackman.

"Driving while handling a mobile phone, in any context, is illegal and dangerous and can have the most serious of consequences."