McCain just badly misstated the history of Pakistan. For someone claiming extensive foreign policy knowledge, this is simply not acceptable. McCain said Pakistan was a failed state before President Musharraf came to power. That is not true.
Musharraf took power in a military coup in 1999 when he diposed Nawaz Sharif - who recently participated in the latest election. The coup followed the 1999 war in Kashmir with India and was due to a power struggle with Sharif, not due to Pakistan being a "failed state." The United States did not welcome the Musharraf coup. Instead the government of the United States imposed sanctions against this action.
Remember Pakistan had nuclear weapons in 1999. Did McCain believe that there was a failed state that possessed nuclear weapons? If he did he showed no concern at the time. The fact is McCain made a huge gaffe and demonstrated he has little understanding if the region.