In seeking an alliance with Pakistan against militants, America is courting a Muslim nation whose military is fixated on India.