Lawmakers from both parties lined up Thursday behind a military proposal to slow the departure of U.S. troops from Afghanistan, warning that President Obama could jeopardize hard-won gains against the Taliban unless he backs away from his time-based exit plan.

Both Democrats and Republicans on the Senate Armed Services Committee expressed support for steps now under consideration by the White House that would give Gen. John F. Campbell, the commander of U.S. and NATO forces in Afghanistan, leeway to retain additional troops into next year.

“If we’ve learned anything from Iraq, it should be that wars do not end just because politicians say so,” Sen. John McCain (R-Ariz.), the committee chairman, said during a hearing on U.S. operations in Afghanistan.

Sen. Jack Reed (R.I.), the panel’s ranking Democrat, said he thinks that “any future reductions in U.S. force levels in Afghanistan should be based on the security conditions at the time of the proposed reductions.”

Campbell, who commands a force of 10,600 U.S. troops and more than 2,000 from allied countries, described “considerable” progress in Afghanistan more than 13 years after foreign forces began battling Taliban and al-Qaeda fighters there.

Testifying before the Senate Foreign Relations Committee, Gen. John. F. Campbell, the commander of the International Security Assistance Force in Afghanistan, says he has provided his chain of command with options for troop drawdown in 2015. (Reuters)

He said Afghan forces, which now number 350,000, have grown stronger, and he expressed confidence that new Afghan President Ashraf Ghani would be able to shepherd Afghanistan through a delicate period following the end of the U.S. and NATO combat mission.

But Campbell sought to temper expectations about what his small force will be able to achieve as it mentors Afghan forces and seeks to head off a Taliban comeback under a tight timeline.

“We will need to evaluate and prioritize our efforts in light of restricted resources and the limited time available to accomplish our mission,” he said in prepared remarks.

The general cited shortcomings of Afghan forces in intelligence, air power and special operations and said the Taliban, emboldened by the departure of most foreign forces, was likely to mount a strong offensive this spring and summer.

Such expectations have helped build support among military leaders for making certain changes to the timeline Obama announced in May. That plan would bring the U.S. force to about 5,500 by the end of this year, and to zero by the time Obama leaves office in early 2017.

Campbell said he had presented options for adjusting troop plans but declined to provide details about his recommendations in a public hearing. Officials have said the steps under consideration would allow him to retain more than 5,500 troops into 2016, keep training centers open longer than currently planned, and potentially reorder planned base closures. But they would not alter the deadline for ending the military mission entirely by 2017.

Although Republicans have criticized Obama’s timeline from the start, many Democrats have their own reservations.

“I think it’s okay to have a plan,” said Sen. Timothy M. Kaine (D-Va.). “But you know — but then you need to adjust it, based on the reality.”

Numerous lawmakers voiced concerns that a hasty departure would doom Afghanistan to repeat the experience of Iraq, which is now struggling to expel the Islamist militants who took over a third of the country less than three years after U.S. troops withdrew.