In the 1980s, Arab countries sent troublemakers off to the Afghan jihad - and unwittingly formed a radical army.
The ranks of Osama bin Laden's Al Qaeda terror network were formed in part with the help of America's closest allies in the Arab world - Saudi Arabia and Egypt.
For a decade in the 1980s, Saudi Arabia, Egypt, and other pro-Western Arab governments in the Middle East packed their most dangerous Islamic militants off to the so-called Arab jihad - the fight against Soviet occupation - in Afghanistan.
It became a kind of Arab version of the "Dirty Dozen" - a dumping ground for Islamic militants who might otherwise stir up trouble in their home countries.
Some were killed in Afghanistan. But many others survived and organized into a global terrorist network capable of striking at the very heart of US economic and military power.
"Half the countries in the region, including our friends in Egypt, emptied their jails and sent all their troublemakers to Afghanistan with the hope that they might become martyred in the jihad," says Milt Bearden, former chief of Central Intelligence Agency programs in Afghanistan from 1986 to 1989. "But they didn't become martyred," he adds, "because they didn't fight all that much."
Although the CIA has often been accused in press accounts of having nurtured, trained, and supplied Mr. bin Laden and his associates, those who ran the covert aid programs in Afghanistan say the jihad was largely the creation of Saudi Arabia. "The CIA never had any operational relationship with any Afghan Arab - period," Mr. Bearden says.
Saudi Arabia's Arab jihad operation is an example of how the well-meaning efforts of American allies may in the longer run create complications as the United States tries to navigate through a Central Asian minefield of competing interests and unintended consequences. And it is all happening in a country that until a few weeks ago was barely an American afterthought.
The Arab force arrayed in support of the Taliban and presumably still headed by bin Laden is in part a legacy of the Saudi supported operation, as is the extended network of Al Qaeda associates, who are believed to be operating in some 50 countries around the world.
If the United States is to avoid the pitfalls of the former Soviets and the British in prior failed attempts to influence events in Afghanistan, analysts say, it will be necessary for American leaders to have a complete understanding not only of the various Afghan groups and their tangled agendas, but also of the often-conflicting agendas of US rivals and allies in the region.
"There are no white hats in Afghanistan," says Frederick Starr, chairman of the Central Asia-Caucasus Institute in Washington. "The key from now on will be not to get drawn into internal Afghan controversies, which are endless and manipulative."
Analysts say the Saudi royal family had good reason to facilitate the Arab jihad program in the 1980s. In broad terms they saw it as an opportunity to assert leadership in the Islamic community on behalf of Muslims facing oppression by communist invaders. They saw it as a chance to help their close ally Pakistan, while curbing the influence of neighboring Iran.
But they also had an important domestic reason for running the operation - self preservation. The operation arose in early 1980 at a time when the kingdom was facing a double-edged threat from resurgent Islamic fundamentalism in the region.
The rise of Ayatollah Khomeini in Iran increased concerns about upheaval within the large population of Shia Muslims in Saudi Arabia's oil-rich Eastern Province.
And, even more alarming to the Saudis, in November 1979, some 300 armed Sunni fundamentalists stormed the Grand Mosque in Mecca, Islam's holiest shrine. They called for a spontaneous uprising against the Saudi royal family.
It took the Saudis a month with the help of French and Jordanian commandos to recapture the Grand Mosque.
There was no spontaneous uprising, but the royal family got the message loud and clear that Muslim fundamentalists - even adherents of their own orthodox branch of Sunni Islam - posed a direct threat to their continued rule.
While most of the captured rebels were publicly beheaded in cities across the kingdom, it remained unclear how many other Saudis might be sympathetic to such calls for Islamic revolution to topple the House of Saud.
The Soviet invasion and the emerging Afghan resistance offered the royal family a possible solution.
"The Saudi leadership found it very convenient to export these guys to Afghanistan to alleviate some of the pressure at home," says Joseph Kechichian, a Los Angeles-based political consultant and author of "Succession in Saudi Arabia."
"They did it without realizing that 20 to 30 years down the line these [holy warriors] will be so war-hardened and embattled that they will come back to haunt them," he says.
Similar clashes with Islamic militants were taking place in other pro-western Arab governments, including the 1981 assassination of Egyptian President Anwar Sadat.
The Sadat assassination, carried out by Islamic fundamentalists within the Egyptian military, further heightened fears among Arab leaders that their own defense forces were being converted against them from within. The same issue had arisen two years earlier in the Grand Mosque siege. Many of the Saudi rebels were members of the Saudi National Guard, and virtually all of the rebels were armed with weapons supplied from national guard armories.
According to analysts who observed them in Afghanistan, the exported Arab militants weren't always welcomed by the Afghans. Some of the Arabs lectured the Afghans about Islam and criticized them for not being Islamic enough, or for failing to abide by the Arabs' strict interpretation of Islamic doctrine.
Warfare was another matter. Among Afghan mujahideen, the Saudis and other Arab holy warriors were seen as overly zealous and inefficient fighters who in some cases seemed a little too eager to die.
"They called them sheep," says a source with extensive knowledge of Afghanistan who asked not to be identified by name. "The mujahideen used to use sheep to clear minefields, but the Saudis were a lot cheaper."
The extent of Afghan tolerance of the Arab fighters is difficult to gauge. Some analysts say the Arabs have combat experience and pose a substantial military threat even to the combat savvy Afghans. But others say it may be only be a matter of time before Afghans take up arms against the Arab holy warriors.
"A lot of Afghans resent the control of their country's life by these extremist foreigners. They believe that their country has become a religious concentration camp," says Thomas Goutierre, an Afghanistan expert at the University of Nebraska at Omaha.
After the Soviets pulled out of Afghanistan in 1989, the Saudis scaled down their involvement in the jihad effort. But by then bin Laden was already well organized, with his own recruiting operation and independent sources of funding from wealthy Muslims who supported his increasingly extremist outlook, analysts say.
The Arab jihad effort may have bought the Saudi royal family an extra 25 years in avoiding a head-on confrontation with its own home-grown Muslim extremists, says Mr. Kechichian. But he says the result now is that the Saudi royal family is facing an extended period of even greater vulnerability.
This explains the Saudi reluctance to openly grant US access to its military facilities for operations against Iraq, and more recently, against Afghanistan. And it explains Saudi concern about the lack of progress on the Arab-Israeli peace front.
"This goes beyond Osama bin Laden," Kechichian says. "The Saudis are not just concerned about one man, they are concerned about the entire mujahideen infrastructure. Here is a group of mostly young men who are Saudis by birth - a couple hundred, maybe a couple thousand. They have become anti-Western and anti-American, but first and foremost they are anti-Saudi," he says.