Mark Esper is a U.S. defense secretary.

On Sept. 11, 2001, as many of us remember too well, al-Qaeda perpetrated its murderous attacks against the United States that resulted in the tragic loss of life in New York, Washington and an empty field in Pennsylvania. Soon after, the U.S. military deployed to Afghanistan to defeat these terrorists and remove the safe haven that the Taliban offered them. For more than 18 years, America has been protected.

But this success has come at a high price. Nearly 3,000 U.S. and allied troops have been killed in action, thousands more have been wounded, and we have spent more than $1 trillion to keep us safe and help the people of Afghanistan. The U.S. military and our allies have performed remarkably; progress has been made. And while the conflict is still not over, our Afghan partners have rightly taken the lead and borne the brunt of the fight in recent years.

The best guarantee of America’s continued safety, however, is not continuing along this path. Peace will not come through military means; rather, safety and security for the United States, our allies and Afghanistan will be won when all Afghans lay down their arms, sit beside one another and decide their future together. A political solution is the best way forward.

We are now in the early days of such an opportunity. On Saturday, we achieved a promising milestone to bring the war in Afghanistan to a responsible end with the signing of an agreement between the United States and the Taliban. It is a road map to peace, security and stability that, while fraught with many imperfections and uncertainties, is supported by the Afghan government and our NATO allies. Thanks to President Trump’s leadership, it is the best chance we have ever had to end this conflict, to ensure Afghanistan never again becomes a safe haven for terrorists who want to attack America, and to bring our troops home.

Over the past week, we observed a significant reduction in violence in Afghanistan. This set the stage to approve a conditions-based agreement comprised of four main parts: guarantees and mechanisms by the Taliban that will ensure Afghanistan will never be used by terrorists to launch attacks against the United States and its allies; a timeline for the withdrawal of U.S. and allied forces that commences in the next two weeks; the start of intra-Afghan negotiations within 10 days; and, the pursuit of a permanent and comprehensive cease-fire. Throughout this process, as I announced Saturday in Kabul alongside President Ashraf Ghani, the United States will continue its financial and military support to the Afghan government and its security forces. There are other details to the plan’s implementation, and the administration looks forward to briefing them to Congress in the coming days.

While we look forward with cautious optimism, we are prepared for every outcome. Should the Taliban renege on its obligations, it will bear full responsibility for forfeiting a chance for peace, economic opportunity and a role in deciding the future of the country. Given this possibility, we will retain the necessary capabilities to respond with decisive military force to protect our service members, support the Afghan security forces or restart offensive operations.

Ultimately, the success of this agreement will be up to the Afghan people. They have suffered too much for too long; they are a proud people who deserve better. That said, no one has any illusions that the road ahead will be easy. Afghanistan remains a complex country in a challenging region, and there are still many — including people from outside nations — who want the conflict to continue indefinitely for a variety of nefarious reasons. As I told our troops on Saturday: Remain vigilant; we still have a long and difficult mission ahead of us.

Thanks to the bravery, skill and commitment of U.S. service members and their allies, we are now at a point where a stable, secure and unified Afghanistan could become a reality. The almost 800,000 U.S. troops who have deployed there over the past 18 years should take pride in knowing their efforts kept America safe. And the more than 2,400 heroes who never made it home did not die in vain. Because of their sacrifice, America has not faced a terrorist attack from Afghanistan since 9/11. This agreement is now the best chance we have to ensuring it never does again, while safely bringing our troops home.