Image copyright Reuters Image caption Ashraf Ghani's words "contrast" with those of his predecessor, the BBC's David Loyn said

The Afghan president has paid tribute to UK soldiers who died fighting in the country, ahead of services to mark the end of British involvement in the war.

Ashraf Ghani said the 453 UK troops had "paid the ultimate sacrifice to enable us to live in freedom, in hope for peace, prosperity and dignity".

The Queen and many veterans will attend a service at St Paul's Cathedral later to commemorate the end of the war.

A simultaneous service will be held in Afghanistan for troops still there.

The Prince of Wales, the Duchess of Cornwall, the Duke and Duchess of Cambridge and Prime Minister David Cameron are all expected to attend the St Paul's ceremony, which will be followed by a procession through London.

UK forces were part of a US-led coalition which invaded Afghanistan and toppled the ruling Taliban in 2001, following the 9/11 attacks in the US.

'Great honour'

Anne Linley's son, Staff Sgt Brett Linley, was 29 when he was killed as he worked to clear improvised explosive devices in Afghanistan in 2010.

He defused more than 100 bombs and posthumously received the George Medal for "great bravery".

Mrs Linley said it would be a "great honour" to be at St Paul's along with members of the Royal Family and other soldiers' parents.

"I'm looking forward to it but dreading it at the same time because you don't know what kind of emotions it will bring forward," she said.

Speaking about her son, she said: "I miss him all day long... we carry him in our hearts and always will."

Image copyright PA Image caption British troops left Camp Bastion in October then many flew home from Kandahar a month later

A new interim government was set up in December 2001 - but the Taliban kept fighting and has killed thousands of foreign and Afghan government troops over the years since the invasion.

The Taliban remains a powerful force in the country, and declared the "defeat" of the US and its allies when Nato formally ended its combat mission in December.

'Hard to take'

At the peak of the campaign the UK military, which faced regular Taliban attacks, had 9,500 troops and 137 bases in Helmand Province.

Former soldier Craig Gadd, now of Help for Heroes, lost his left leg after stepping on an improvised explosive device in Afghanistan.

He said: "Things happen. I feel very lucky that I only lost one leg. Some of my colleagues have injuries far worse than mine. I've done some amazing things since that day."

Pte James Prosser was killed in Afghanistan in 2009. His mother Sarah Adams told the Today programme that the country had not been left as safe as was intended.

"James believed in what he was doing, and I have to try to accept that, that he wanted to do that and believed he should be there. But as a mum, it's very difficult.

"It's just very hard to take that we didn't leave it as we were supposed to leave it. We did achieve a lot but we didn't make it the safest place and it's still ongoing. Afghan people are still losing their lives because of the Taliban."

L/Cpl James Ashworth was killed in 2012 and posthumously awarded the Victoria Cross.

His father Duane Ashworth said he believed the situation in Afghanistan had improved, adding: "I do believe that the country is in a better position than it was when we first arrived 13 years ago. It's now for the forces that are there to continue that training with the Afghan forces and police, to make sure what our lads did does continue."

Karzai 'clash'

The last British combat troops left in October last year, though some still remain in training, advisory and support roles.

As well as paying tribute to Britain's war dead, President Ghani spoke of the enduring legacy of the UK's commitment at the British-run officer training academy near Kabul.

BBC Afghanistan correspondent David Loyn said: "President Ghani's tribute contrasts strongly with complaints by his predecessor President Karzai, who said that the British presence had made things worse in Helmand and frequently clashed with British diplomats and soldiers about their role.

"The new government in Afghanistan sees things very differently."