ISLAMABAD -- The countdown to the signing of a peace agreement between the Taliban and the United States on Feb. 29 to end the 18 years of war in Afghanistan will begin at midnight Friday, when a seven-day "reduction of violence" promised by the Taliban goes into effect, an Afghan official said.

After that weeklong period, the long-sought peace agreement between the U.S. and the Taliban will be signed in Doha, Qatar, paving the way for a withdrawal of U.S. troops and intra-Afghan negotiations, a senior U.S. State Department official said The official spoke on condition of anonymity to discuss the deal and its details. .

The period of reduced violence is due to start at midnight Friday local time (1930 GMT, 2:30 p.m. EST), according to the Afghan official who spoke on condition of anonymity because he was not authorized to talk to the media.

The Taliban have maintained a political office in Doha in recent years, following the 2001 U.S.-led invasion that toppled their regime, which had harboured al-Qaida leader Osama bin Laden, in Afghanistan.

U.S. Secretary of State Mike Pompeo said the peace agreement will lead to an eventual permanent cease-fire. The deal also envisions guarantees from the Taliban that Afghanistan will not be used to attack the U.S. or its allies, and provides for the phased withdrawal of American and other foreign forces from the country over 18 months.

"We are preparing for the signing to take place on Feb. 29," Pompeo said in a statement. "Intra-Afghan negotiations will start soon thereafter and will build on this fundamental step to deliver a comprehensive and permanent cease-fire and the future political road map for Afghanistan. `'

But that road is fraught with difficulties.

"The only way to achieve a sustainable peace in Afghanistan is for Afghans to come together and agree on the way forward," Pompeo said in his statement.

It's still not clear who will represent Kabul for the intra-Afghan talks, considered a key pillar in finding a lasting peace. Afghanistan's election commission earlier this week declared President Ashraf Ghani the winner of the September 2019 presidential election, but his rivals quickly denounced the outcome.

The Taliban have refused to talk to Ghani's government and also denounced the results of the balloting, saying they will talk to government representatives but only as ordinary Afghans.

Pompeo's statement did not say who would represent Kabul, only that "'intra-Afghan negotiations will start soon" after the signing in Doha "and will build on this fundamental step to deliver a comprehensive and permanent cease-fire and the future political road map for Afghanistan."

Germany and Norway have both offered to host the talks but no venue has yet been set. A statement from Ghani simply said he met with U.S. Peace Envoy Zalmay Khalilzad and "the two sides spoke about the details of the reduction in violence."'

In their own statement Friday, the Taliban said: "Both parties will now create a suitable security situation in advance of agreement signing date, extend invitations to senior representatives of numerous countries and organizations to participate in the signing ceremony, make arrangements for the release of prisoners, structure a path for intra-Afghan negotiations with various political parties of the country and finally lay the groundwork for peace across the country with the withdrawal of all foreign forces."

The Taliban added that they will not allow "the land of Afghanistan to be used against security of others so that our people can live a peaceful and prosperous life under the shade of an Islamic system."

Under the terms of the `'reduction in violence," which covers all of Afghanistan and also applies to Afghan forces, all sides have committed to end attacks for a seven-day period. For the Taliban, that includes roadside bombings, suicide attacks and rocket strikes.

Pakistan welcomed the announced reduction in violence.

"'We hope the Afghan parties would now seize this historic opportunity and work out a comprehensive and inclusive political settlement for durable peace and stability in Afghanistan and the region," said a Pakistan Foreign Ministry statement. Pakistan still hosts more than 1.4 million Afghan refugees.

The peace deal also calls for the release of 5,000 Taliban prisoners, most of whom are being held in jails run by the Afghan government. Although the U.S. has already discussed the prisoner release with government representatives, there has been no public announcement about it from Ghani's government.

If the peace deal is signed, President Donald Trump can claim to have taken a first step toward meeting his 2016 campaign pledge to withdraw U.S. troops. But if it fails, Trump could be painted by his Democrat adversaries as being naive and willing to sacrifice the security of U.S. soldiers and interests for the sake of political expediency.

The Pentagon has declined to say whether the U.S. had agreed to cut its troop levels in Afghanistan to zero. Defence Secretary Mark Esper has said if the seven-day truce is successful and the Afghan peace talks begins, the U.S. would reduce its troop contingent "over time" to about 8,600.

There are about 12,000 U.S. troops in the country. During any withdrawal, the U.S. would retain the right to continue counterterrorism operations in Afghanistan, which have been focused mainly on an Islamic State group's affiliate and al-Qaida, according to Pentagon officials.

Suhail Shaheen, spokesman for the Taliban's political office in Doha, tweeted that the Taliban expect a complete withdrawal. In a Pashto language tweet, he said, "based on the agreement with the U.S., all international forces will leave Afghanistan and the invasion will end and no one will be allowed to use Afghan soil against others."

In Brussels, NATO Secretary-General Jens Stoltenberg welcomed the developments as "a critical test of the Taliban's willingness and ability to reduce violence, and contribute to peace in good faith."

"This could pave the way for negotiations among Afghans, sustainable peace, and ensuring the country is never again a safe haven for terrorists," he said.

The U.S.-led alliance has some 16,000 troops in Afghanistan helping to train its security forces, but it could draw down its operation to accommodate any firm peace agreement.

------

Lee reported from Washington. Associated Press writers Lorne Cook in Brussels, Lolita Baldor and Robert Burns in Washington, and Tameem Akhgar in Kabul, Afghanistan, contributed