In interviews with The New York Times, a former Taliban finance minister described how he traveled to Saudi Arabia for years raising money while ostensibly on pilgrimage.
The Taliban have also been allowed to raise additional millions by extorting “taxes” by pressing hundreds of thousands of Pashtun guest workers in the kingdom and menacing their families back home, according to Vali Nasr, a former State Department adviser.
Yet even as private Saudi money backed the Taliban, Saudi intelligence once covertly mediated a peace effort that Taliban officials and others involved described in full to The Times for the first time.
Playing multiple sides of the same geopolitical equation is one way the Saudis further their own strategic interests, analysts and officials say.
But it also threatens to undermine the fragile democratic advances made by the United States during the past 15 years, and potentially undo efforts to liberalize the country.
The United States now finds itself trying to persuade its putative ally to play a constructive rather than destructive role. Meanwhile, the Afghans have come to view Saudi Arabia as both friend and foe.
The question now, as Afghan officials look for help, is which Saudi Arabia will they get?
Prince Turki al-Faisal, who led the Saudi intelligence agency for over 24 years and later served as ambassador to the United States until his retirement in 2007, rejected any suggestion that Saudi Arabia had ever supported the Taliban.
“When I was in government, not a single penny went to the Taliban,” he wrote in emailed comments.
He added that the “stringent measures taken by the kingdom to prevent any transfer of money to terrorist groups” had been recognized by Daniel L. Glaser, the United States assistant secretary for terrorist financing at the Treasury, in testimony to Congress in June.
Others say the verdict is still out. “We know there has been this financing that has gone on for years,” Hanif Atmar, director of the Afghan National Security Council, said in an interview. “This sustains the terrorist war machine in Afghanistan and in the region, and it will have to be stopped.”
That may be easier said than done. Saudi Arabia remains one of the main sources of what Secretary of State John Kerry recently called “surrogate money” to support Islamist fighters and causes.
Much of that largess is spread about in pursuit of what Mr. Nasr describes as a Saudi strategy of building a wall of Sunni radicalism across South and Central Asia to contain Iran, its Shia rival.
That competition is being rekindled. With the Americans leaving, there is the sense that Afghanistan’s fate is up for grabs.
In recent months, the Taliban has mounted a coordinated offensive with about 40,000 fighters across eight provinces — a push financed by foreign sources at a cost of $1 billion, according to Afghan officials.
At the same time, Saudi Arabia is offering the Afghan government substantial defense and development agreements, while Afghans say sheikhs from Saudi Arabia and other Arab Persian Gulf states are quietly funneling billions in private money to Sunni social organizations, madrasas and universities to shape the next generation of Afghans.
“The Saudis are re-engaging,” said Mr. Nasr, now dean of the Johns Hopkins School of Advanced International Studies, in a telephone interview. “Afghanistan is important to them, which is why they invested so much in the 1980s, and they are looking to make themselves much more relevant.”
The seven-year Taliban theocracy in Afghanistan was coming to a fiery end. It was 2001, and the Taliban government was collapsing under the United States bombing campaign unleashed in retaliation for the Sept. 11 attacks.
Disguising himself as a doctor, Agha Jan Motasim, the Taliban finance minister, escaped over a remote border crossing into Pakistan aboard a Red Crescent ambulance, he said in a recent interview.
In the Pakistani border town of Quetta, he and other Taliban leaders regrouped and began organizing the insurgency that continues today. Mr. Motasim was appointed head of the finance committee and set about collecting funds.
One of his first stops was Saudi Arabia.
As home to both enormous oil wealth and Islam’s holiest sites, it was the perfect place to make appeals not only to rich Saudi sheikhs and foundations but also to important donors who traveled to the kingdom on pilgrimage from all over the Muslim world.
Between 2002 and 2007, Mr. Motasim traveled to Saudi Arabia two or three times a year. Ostensibly he went on pilgrimage, but his primary purpose was to raise cash for the Taliban.
“There were people coming from other countries for umrah and hajj,” he said referring to the different Muslim pilgrimages. “Also the Saudi sheikhs would come as well. I would ask them for their help for the war.”
“It was not only the Saudis who would help us but people who would come from different countries,” he recalled. “Saudi Arabia was the only country where I could meet them.”
Once secured, the money could be moved in myriad ways to Taliban coffers, officials in the region said, including through regional banks close to Pakistan’s tribal areas and the hawala system of informal money-changers.
Last year, Afghan security forces even discovered families of members of Al Qaeda entering eastern Afghanistan with a stash of gold bars, according to Rahmatullah Nabil, the former head of Afghanistan’s intelligence agency, the National Directorate of Security.
The Saudi authorities often say they cannot control or always identify the millions of Muslims who travel to the kingdom every year on the hajj, said Barnett Rubin, who worked as special adviser to the United States envoy for Afghanistan and Pakistan.
The Taliban always traveled on fake Pakistani passports under assumed names and were unknown to Saudi authorities, according to a security official in the region, who spoke on condition of strict anonymity, citing the extreme sensitivity to upsetting Saudi Arabia.
American requests to cut the funding yielded little result.
In 2009, American officials complained that the Taliban and other extremist groups were raising millions of dollars during annual pilgrimages, according to American diplomatic cables released by WikiLeaks.
A December 2009 cable from Secretary of State Hillary Clinton stated that donors in Saudi Arabia constituted the “most significant source of funding to Sunni terrorist groups worldwide.”
The cables date from a period when Richard C. Holbrooke, who died in 2010, acted as special envoy for Afghanistan and Pakistan, and actively sought to curb funding to the Taliban, if in vain.
The funding from the gulf extended well beyond that period and to other groups besides the Taliban, including the Islamic State, also known as ISIS or ISIL.
In a leaked email from 2014, Mrs. Clinton described the governments of Qatar and Saudi Arabia as “providing clandestine financial and logistic support to ISIL and other radical Sunni groups in the region.”
Financing such groups, she wrote, was part of a contest between Qatar and Saudi Arabia, who were in “ongoing competition to dominate the Sunni world.”