Security advisor confirms US had military talks with Pakistan