The military quagmires in both Iraq and Afghanistan raise an important question. Namely, what is the number of soldiers required for a successful occupation transforming a barbaric society into a first-world one?
History offers 3 clues: Germany, Japan, and Taiwan. After Washington and its allies defeated Germany in 1945, they partitioned the nation into 4 sectors run by the victors. The population in the American sector numbered about 16 million people at the end of 1946. Washington stationed about 200,000 American soldiers in its sector. The ratio of civilians to occupying soldiers was about 80. Note that the Germans accepted the occupation and supported the political and economic modernization of their society.  The occupation succeeded.
After the American military defeated Japan in 1945, its population numbered about 71.04 million people. Washington stationed 354,675 American soldiers in the nation. The ratio of civilians to occupying soldiers was about 200. Note that the Japanese accepted the occupation and supported the political and economic modernization of their society.  The occupation succeeded.
After the Japanese military defeated China in 1895, the Chinese government gave Taiwan to Tokyo. At that time, the population in Taiwan numbered about 3 million people, and Tokyo stationed about 50,000 soldiers in Taiwan. The ratio of civilians to occupying soldiers was about 60. Note that, at the beginning of the Japanese occupation, the Taiwanese violently opposed it.  Nonetheless, Tokyo eventually succeeded in quelling the uprisings and in transforming a backward society into a first-world society. By the time of the Japanese surrender in 1945, the overwhelming majority of Taiwanese was educated, understood notions of democracy and human rights, and demanded them.
Of these 3 cases, Taiwan best applies to the conflicts in both Iraq and Afghanistan. In Iraq, Washington is desperately trying to transform a relatively barbaric society (clinging to Islamic fundamentalism) into a first-world society. Yet, the majority of Iraqis is either indifferent to the American efforts or violently opposing them. The situation in Afghanistan is similar.
The population in Iraq numbers about 26,783,383.  The ratio (of civilians to occupying soldiers) required for a successful occupation is 60. In other words, it requires about 450,000 troops. The actual number of soldiers deployed by Washington and its Western allies is about 200,000. 
Suppose that we can discount the Kurds from the general population requiring the presence of occupying soldiers. This supposition is reasonable since the success of Kurdistan in Northern Iraq proves that the Kurds are committed to building a first-world society. Omitting the Kurds leaves a population (which is mostly Arab) of about 21,962,374 people.  The number (of troops) required to maintain order among this smaller population is about 370,000.
Turning to Afghanistan, its population numbers about 31,056,997.  The ratio (of civilians to occupying soldiers) required for a successful occupation is 60. In other words, it requires about 520,000 troops. The actual number of soldiers deployed by Washington and its Western allies is 39,815, of which 20,115 are NATO troops. 
Note that an overly optimistic ratio for a successful occupation is 200, which is the ratio utilized by the American military in the occupation of Japan. This ratio translates to about 160,000 soldiers in Afghanistan. The actual number of Western soldiers deployed there is significantly less than even this optimistic figure.
To understand the nature of the optimism, consider the Soviet invasion of Afghanistan in 1979. At that time, the population in Afghanistan numbered about 15.6 million people.  To subjugate them under the yoke of Moscow, the Soviet military utilized about 100,000 troops.  The resulting ratio (of civilians to occupying soldiers) was about 156. The consequence of this low ratio was that the Afghan guerrillas slaughtered 15,000 Soviet soldiers and drove Moscow out of Afghanistan by 1989. If the occupation ratio of 156 is too high, what will happen to the Western military force at its current occupation ratio of 780?
In obvious conclusion, without substantial increases in the number of troops deployed in Iraq and Afghanistan, both quagmires will end in total failure.
1. James Dobbins, John G. McGinn, Keith Crane, Seth G. Jones, Rollie Lal, Andrew Rathmell, Rachel M. Swanger, and Anga Timilsina, "Chapter Two: Germany", America's Role in Nation-Building: From Germany to Iraq, document number MR-1753-RC, Rand Corporation, 2003 (ISBN: 0-8330-3460-X).
2. James Dobbins, John G. McGinn, Keith Crane, Seth G. Jones, Rollie Lal, Andrew Rathmell, Rachel M. Swanger, and Anga Timilsina, "Chapter Three: Japan", America's Role in Nation-Building: From Germany to Iraq, document number MR-1753-RC, Rand Corporation, 2003 (ISBN: 0-8330-3460-X).
3. Kiyoshi Ito, "Chapter 5: The Republic of Taiwan", Taiwan History, 1996 July (translator: Walter Chen).
4. "Iraq", The World Factbook, Central Intelligence Agency, 2006.
5. "Military: US Forces Order of Battle", GlobalSecurity.org, 2006 August.
6. "Afghanistan", The World Factbook, Central Intelligence Agency, 2006.
7. "NATO seeks more Afghanistan troops", CNN, 2006 September 8.
8. Molly Moore and John Ward Anderson, "NATO Faces Growing Hurdle As Call for Troops Falls Short", "The Washington Post", 2006 September 18.
9. "Population, Health and Human Well-being: COUNTRY PROFILE - Afghanistan", World Resources Institute, 2006.
10. "Afghanistan War", The Columbia Electronic Encyclopedia, 6th edition, 2006.