SPANISH troops will pull out of Afghanistan at the end of October after a constant 13-year presence in the conflict-ridden Asian country.
The 464 soldiers currently based at Herat, in the west of Afghanistan, will come home in two months' time, with only around 20 officials at the NATO base in Kabul remaining for the foreseeable future.
Spain is involved in the 'resolute support' mission in Afghanistan, aimed at strengthening the process of stabilising the country's political climate and providing back-up for Afghan security forces and emergency services.
Until the beginning of this year, Spanish soldiers were participating in the so-called International Security Assistance Force (ISAF) mission, but their role has mainly been that of re-establishing proper law and order and civil protection rather than front-line combat fighting in the last few years.
A day after the 9/11 attacks on the Twin Towers in New York and the Pentagon in Washington DC, the Atlantic Committee of NATO applied Article 5 of the Treaty of Washington for the first time in history: here, all signatory countries are required to respond where one of them has suffered an armed offensive.
At the same time, the United Nations called for the international community to provide urgent assistance to the Afghan population who were living under Taliban rule – an extremist régime in which women were not allowed to work or even show their faces at the window of their homes, and could be shot or stoned to death for showing an inch of flesh in public even by accident, or for going outside without being accompanied by a male relative.
The ISAF mission, which started just before Christmas 2001 under the Bonn Treaty, was aimed at reinforcing security in the capital, Kabul, and fending off Afghan insurgents.
At the end of January 2002, a total of 350 Spanish soldiers were sent to Kabul, and three years later Spain took over running the base in Herat where it set up the tented hospital Role 2E.
Later in 2005, Spanish troops took charge of the Provincial Reconstruction Team (PRT) in Qala-i-Naw.
At the height of the string of missions, over 1,500 Spanish soldiers were based in Afghanistan, but from 2012 when security matters were transferred to Badghis, they gradually began to return home.
Some 18,000 Spanish soldiers have been out to Afghanistan in the past 13-and-a-half years, of whom 98 have been killed in the war zone, plus two interpreters who worked with the troops from Spain.
The cost of the mission is said to be upwards of €3 billion.
Photograph: Spain's president Mariano Rajoy on a pre-Christmas visit to the country's troops in Qala-i-Naw, Afghanistan