Militants operating out of safe havens in Pakistan remain a major threat to Afghanistan but cooperation between Nato-led forces and the Pakistani military is increasing, US Defense Secretary Robert Gates said on Friday. Devastating floods over the past month have delayed Pakistan's military from going after militants in the Fata and North Waziristan. Afghanistan regularly blames Pakistan for allowing militant groups to flourish there, President Hamid Karzai describing them as a great threat to Afghan security. Before leaving Afghanistan, Gates went south to Kandahar, the birthplace of the Taliban, to visit US troops and described the Islamist militants as a resilient enemy. He said he and Karzai agreed on the need for stepped up cooperation between the Nato-led International Security Assistance Force (ISAF) and the Pakistani military to get rid of insurgent sanctuaries.