Image copyright AFP Image caption Residents in the eastern city of Jalalabad celebrated the reduction in violence on Friday

President Donald Trump has called on Afghans to embrace prospects for peace, as the US prepares to sign an agreement with the Taliban on Saturday.

Secretary of State Mike Pompeo is due to attend the signing in Qatar. The agreement will see thousands of US troops withdraw from Afghanistan in return for security guarantees.

It follows a week-long partial truce with the Taliban.

The accord raises hopes for a wider peace process after 18 years of war.

"Soon, at my direction, Secretary of State Mike Pompeo will witness the signing of an agreement with representatives of the Taliban," President Trump announced in a statement on Friday.

He added that the deal had the potential to create "a powerful path forward to end the war in Afghanistan and bring our troops home".

"Ultimately it will be up to the people of Afghanistan to work out their future," Mr Trump said. "We, therefore, urge the Afghan people to seize this opportunity for peace and a new future for their country."

The agreement would see the Taliban agree to hold talks with the Afghan government, which they have dismissed in the past as American "puppets".

The week-long truce leading up to the signing is judged to have largely held, with only minor incidents.

US Defence Secretary Mark Esper will be in Kabul on Saturday to sign a joint declaration with the Afghan government.

It has taken more than a year of intensive negotiations in Doha and extensive consultations in Kabul and many other capitals.

This is a historic moment - a significant step towards ending America's longest war and the beginning of a process which Afghans hope will end a devastating conflict more than four decades long.

Taliban commanders, in messages to their supporters, boast of winning the war and defeating the American empire. This agreement will test their pledge to seek peace and to prevent Afghanistan from again becoming a haven for extremist groups.

US officials insist their troop pullout hinges on the Taliban keeping their word. If they do, the first contingent of some 5,000 soldiers - out of about 13,000 now serving in Afghanistan - will leave over the next several months.

Afghans, so weary of war, are torn - between cautious hope and profound anxiety.

How did the talks come about?

In December 2018, the Taliban announced they would meet US officials to try to find a "roadmap to peace". But the militants continued to refuse to hold official talks with the government in Kabul.

Media playback is unsupported on your device Media caption The view from Lashkar Gah province on whether peace with the Taliban is possible

Following nine rounds of US-Taliban talks in Qatar, the two sides seemed close to an agreement. Washington's top negotiator announced in September 2019 that the US would withdraw 5,400 troops from Afghanistan within 20 weeks as part of a deal agreed "in principle" with Taliban militants.

But days later, Mr Trump said the talks were "dead", after the militant group admitted to killing a US soldier.

"They thought that they had to kill people to put themselves in a little better negotiating position", he told reporters, calling the attack "a big mistake".

For months after the deal collapsed, there was no let-up in fighting.

Media playback is unsupported on your device Media caption Meet Fatima and Fiza, some of the women removing landmines in Afghanistan

Since 2011, Qatar has hosted Taliban leaders who have moved there to discuss peace in Afghanistan. It's been a chequered process. A Taliban office was opened in 2013, and closed the same year amid rows over flags. Other attempts at talks stalled.

Qatar was also the host of a major conference in July that agreed a roadmap for Afghan peace. Significantly it included both the Taliban and Afghan government officials, though the latter attended in a "personal capacity".

What's the background to the Afghan war?

It began when the US launched air strikes one month after the 11 September 2001 attacks on the US. The Taliban had refused to hand over the man behind them, Osama Bin Laden.

Media playback is unsupported on your device Media caption Tens of thousands of Afghan soldiers have been killed and injured. This is their story

The US was joined by an international coalition and the Taliban were quickly removed from power. However, they turned into an insurgent force and continued deadly attacks, destabilising subsequent Afghan governments.

The international coalition ended its combat mission in 2014, staying only to train Afghan forces. But the US continued its own, scaled-back combat operation, including air strikes.

The Taliban has however continued to gain momentum and in 2018 the BBC found they were active across 70% of Afghanistan.

Media playback is unsupported on your device Media caption The BBC was given exclusive access to spend a week with ambulance workers in Afghanistan.

Nearly 3,500 members of the international coalition forces have died in Afghanistan since the 2001 invasion, more than 2,300 of them American.

The figures for Afghan civilians, militants and government forces are more difficult to quantify. In a February 2019 report, the UN said that more than 32,000 civilians had died. The Watson Institute at Brown University says 58,000 security personnel and 42,000 opposition combatants have been killed.