Sen. Lindsey Graham, R-S.C., warned Monday that the United States cannot make the same mistake that it did in Iraq after a peace agreement with the Taliban was signed over the weekend.

"Let's give it a try. I would love to see the war in Afghanistan end," said Graham, cautioning that the peace deal does not cover ISIS or al Qaeda groups operating in Afghanistan.

"It's with the Taliban. We'll see if they honor the peace deal. But the one thing I want to stress to your viewers is let's not do in Afghanistan what Obama did in Iraq, pull the plug on the place and allow radical Islam to come roaring back. Americans were killed as a result of the rise of ISIS, people all over the planet were killed," said Graham.

JIM HANSON: TRUMP'S TALIBAN PEACE DEAL IS RIGHT MOVE -- AFTER ALMOST 20 YEARS IT'S TIME TO EXIT AFGHANISTAN

After nearly two decades of conflict, the United States and the Taliban signed a peace agreement Saturday that is aimed at ending America's longest war and will bring U.S. troops home more than 18 years after they invaded in the wake of the Sept. 11, 2001, terrorist attacks.

The deal, which was signed by chief negotiators and witnessed by Secretary of State Mike Pompeo in Doha, Qatar, could see the withdrawal of all American and allied forces in the next 14 months and allow the president to keep one of his key 2016 campaign pledges to extract the U.S. from an "endless war."

Under the deal, the U.S. would draw its forces down to 8,600 from 13,000 in the next three to four months -- a number Graham said was "enough." A complete retraction would depend on the Taliban's ability to meet its promises.

Graham said he hopes the war can be ended "smartly," stressing that a U.S. force will be needed in the country for "years to come" to conduct counterterrorism operations.

Another condition of the agreement calls for the release of 5,000 Taliban members from Afghan-run jails, although it was not clear if the Afghan government will comply with that.

Additionally, a senior administration official told reporters earlier this week that the deal "explicitly mentions al Qaeda" and calls for the Taliban to cut all ties.

CLICK HERE FOR THE FOX NEWS APP

"Today, we are realistic," Pompeo told reporters. "We are seizing the best opportunity for peace in a generation."

To date, according to The Associated Press, the United States has spent nearly $1 trillion in Afghanistan and more than 3,500 U.S. and coalition soldiers have died there. More than 2,400 of them were Americans. Saturday's agreement sets the stage for March 10 intra-Afghan talks in Oslo, with the aim of forming a power-sharing agreement between rival Afghan groups.

Fox News' Paulina Dedaj, Julia Musto and AP contributed to this report.