Bilateral security deal ensures that President Obama will pass off the Afghanistan war and his new war in Iraq and Syria to his successor

The longest war in American history will last at least another decade, according to the terms of a garrisoning deal for US forces signed by the new Afghanistan government on Tuesday.

Long awaited and much desired by an anxious US military, the deal guarantees that US and Nato troops will not have to withdraw by year’s end, and permits their stay “until the end of 2024 and beyond.”

The entry into force of the deal ensures that Barack Obama, elected president in 2008 on a wave of anti-war sentiment, will pass off both the Afghanistan war and his new war in Iraq and Syria to his successor. In 2010, his vice-president, Joe Biden, publicly vowed the US would be “totally out” of Afghanistan “come hell or high water, by 2014.”

Obama called Tuesday “a historic day” for the US and Afghanistan, as the security pact, which puts US troops beyond the reach of Afghan law, “will help advance our shared interests and the long-term security of Afghanistan.”

The primary explicit purpose of the deal, known as the Bilateral Security Agreement, is to permit the US to continue training Afghanistan’s roughly 350,000 security forces, which the US and Nato have built from scratch.

But with domestic US political acrimony swirling over the rise of the Islamic State (Isis) after the 2011 US withdrawal from Iraq, the accord is also a hedge against the resurgence of the Taliban and a recognition that 13 years of bloody, expensive war have failed to vanquish the insurgency.

Any earlier termination of the deal must occur by mutual consent, ensuring a US veto in the event of an about-face by newly inaugurated President Ghani or his successor. Ghani’s predecessor, Hamid Karzai, incensed the Obama administration by refusing to sign the basing deal, rebuking the country that installed him as Afghanistan’s leader after the US drove the Taliban from Kabul in 2001.

Ghani also agreed to a garrisoning accord with Nato forces, known as a Status of Forces Agreement. Nato has agreed to fund Afghanistan’s soldiers and police through 2017.

Under the Bilateral Security Agreement’s annexes, the US military will have access to nine major land and airbases, to include the massive airfields at Bagram, Jalalabad and Kandahar, staging areas not only for air operations in Afghanistan but the US drone strikes that continue across the border in tribal Pakistan.

The additional bases – in Kabul, Mazar-i-Sharif, Herat, Helmand, Gardez and Shindand – ensure the reach of the US military throughout Afghanistan.

US defense leaders greeted the signing of the accord with enthusiasm.

“These agreements will enable American and coalition troops to continue to help strengthen Afghan forces, counter terrorist threats, and advance regional security,” said Defense secretary Chuck Hagel.

“Our partnership is an important one, and as we prepare to transition to a traditional security cooperation mission in the coming years, we remain committed to providing the necessary support to our Afghan partners and, in particular, to their national security forces,” said General Lloyd Austin, commander of US forces in the Middle East and South Asia.

In May, Obama pledged to reduce the US troop presence to 9,800 through most of 2015, ahead of what he called a “normal embassy presence” by the end of his presidency. Yet he hedged by saying the US will continue to conduct counterterrorism operations in Afghanistan, a less visible mission than the training of Afghan forces.

Nothing in the bilateral deal prevents a US president from ramping troop levels back up. The accord’s terms “acknowledge that US military operations to defeat al-Qaida and its affiliates may be appropriate in the common fight against terrorism.”

The “intention” of future counter-terrorism missions in Afghanistan is to partner US and Afghan forces together, with the goal of placing the Afghans in the lead, similar to the broader training mission. In 2013, Rolling Stone released a video showing Afghan forces that the US relies upon for counter-terrorism torturing a detainee.

In a September 25 letter to Ghani, Human Rights Watch urged the new president to end the “widespread impunity for members of the security forces responsible for serious violations of human rights in Afghanistan.”