President Trump seems to have realized that the most logical path to peace in Afghanistan lies in negotiating an agreement with the Taliban.

Since taking office, President Donald Trump’s approach to the war in Afghanistan has been to keeps his cards close to his chest and not disclose troop movements, numbers, or any timetable for withdrawal. But two years later, it appears the Trump administration has finally realized that military victory over the Taliban in Afghanistan is unlikely. The Trump administration has ordered the military to start withdrawing roughly 7,000 troops from Afghanistan in the coming months, two defense officials said, marking an abrupt shift in the 17-year-old war there.

Signs now point to Trump pulling all U.S. troops out of Afghanistan before the 2020 election season, according to NBC News.

The war effort may be remembered as a tremendous waste of lives and money. The U.S. has spent $15.5 billion in Afghanistan over 11 years, according to the Special Inspector General for Afghanistan Reconstruction, who adds that that figure is probably “only a portion.”

Despite all these sacrifices—including the loss of more than 33,000 civilian and combatant lives—the Taliban are stronger than ever. The Afghan government controls only about 56 percent of its districts, with the rest either under rebel control or in a “contested” state, controlled by neither the Afghan government nor the rebellion.

Something must change. Staying the course in Afghanistan is neither logical nor productive. Trump is right to explore a political solution with the Taliban, and his decision to begin withdrawing troops may be signal to the Taliban and the Afghan government that the U.S. is serious about putting this war to an end.

The ground for peace in Afghanistan is fertile. Afghans want peace more than anything, for obvious reasons: the non-stop violence has wrecked the economy and pierced a hole in the collective heart of the nation.

In June, a group of Afghans aged 17 to 65 from the Helmand province started a thousand-kilometer, barefoot journey toward Kabul that the New York Times called a “grass-roots peace movement.” After arriving in the Afghan capital city, they pitched tents in front of the embassies of the U.S., Pakistan, Great Britain and other nations. They said they were calling for governments to find a peaceful end to the conflict.

According to a survey by the Asia Foundation, more than half of all Afghans believe that reconciliation between the Afghan government and the Taliban is possible.

Of course, the Taliban still has its share of opponents. Three-quarters of Afghans are under the age of 40, and members of this younger generation, along with women and human-rights activists, don’t want to live under a Taliban regime that could take away their freedoms and punish them for criticizing their government.

To those who lived under the regime in the early 1990s, the Taliban evoke dark memories of when men were flogged for not growing a beard and women were deprived of education and the right to work in public.

Others doubt the Taliban’s trustworthiness.

“We are not judging it too prematurely,” said Afghanistan Chief Executive Abdullah Abdullah, “but I would say that our experience as of now has been that they (the Taliban) have not shown any intention to get seriously engaged in the peace negotiations.”

In a reversal of longstanding policy, American diplomats recently held face-to-face talks with Taliban representatives in Qatar without Afghan government officials present, according to two senior Taliban officials.

Afghanistan has changed since 2001, when U.S troops first arrived. Its citizens now enjoy greater freedom of speech, free markets and democracy—but the country still ranks among the top ranks among the top five globally for corruption.

The lack of law and order, the failure of government to render justice, and the continuing presence of foreign troops do not sit well with the citizens. These factors have led those in many rural areas to see the Taliban as a force for positive change.

This is not the Taliban of 1990, who ruled with an iron fist. A new generation has infiltrated the group, and their leadership has changed. The Taliban are fighting to win hearts and minds.

This does not mean the Taliban are winning. Territory may change hands, but probably not enough to tip the balance in favor of either side. As such, the Taliban’s best option now is to pursue a negotiated settlement.

At this point, the Taliban insist that they talk directly with the U.S., not the American-backed Afghan government. Although Afghan and Taliban officials have met several times in the past, including a recent meeting in Moscow, those talks have produced no tangible results.

The Afghan government’s position has been clear. At the Geneva Conference in November, Afghanistan President Ashraf Ghani said his government has “formulated a road map” for prospective peace negotiations with Taliban insurgents to end the 17-year war. “We seek a peace agreement in which the Afghan Taliban would be included in a democratic and inclusive society,” Ghani said.

The U.S. approach since Trump took over has been increased bombing to pressure the Taliban, while simultaneously calling them to come to the negotiating table with the Afghan government. The U.S and its allies dropped 2,911 bombs on Afghanistan during the first six months of 2018, according to data from the U.S. Air Force Central Command. ​That is nearly twice the number of bombs dropped on Afghanistan in the same period last year.

Trump is motivated to end U.S. involvement in this war for political and financial reasons, but it could be a boon for Afghanistan if certain goals are accomplished.

The Taliban would have to respect freedom of speech and women’s rights, lay down their arms, and agree to participate in a democratic process. They would have to sever all ties to international terrorist and Muslim extremist groups. The Afghan government would have to embrace the Taliban by sharing power.

If it gets these commitments, the U.S. should set a timeline for full military withdrawal. The new cooperative government in Afghanistan likely would not pose any danger to U.S. interests.

Nobody expects the Taliban to change their religious beliefs. This pragmatic peace agreement may lead to an Afghanistan that looks a bit like Iran: women may go to school, but they must wear their hijab. The Taliban presence could be heavily felt. But it would be better than a forever war, and much better than doing nothing.

If the U.S. withdraws from Afghanistan, it will benefit. If Afghanistan can find peace with a joint government that includes the Taliban, both will benefit. If these things lead to the end of what looked to be a forever war, the world will benefit.