This paper studies binary hypothesis testing based on measurements from a set of sensors, a subset of which can be compromised by an attacker. The measurements from a compromised sensor can be manipulated arbitrarily by the adversary. The asymptotic exponential rate, with which the probability of error goes to zero, is adopted to indicate the detection performance of a detector. In practice, we expect the attack on sensors to be sporadic, and therefore the system may operate with all the sensors being benign for an extended period of time. This motivates us to consider the trade-off between the detection performance of a detector, i.e., the probability of error, when the attacker is absent (defined as efficiency) and the worst-case detection performance when the attacker is present (defined as security).We first provide the fundamental limits of this trade-off, and then propose a detection strategy that achieves these limits. We then consider a special case, where there is no trade-off between security and efficiency. In other words, our detection strategy can achieve the maximal efficiency and the maximal security simultaneously. Two extensions of the secure hypothesis testing problem are also studied and fundamental limits and achievability results are provided: 1) a subset of sensors, namely "secure" sensors, are assumed to be equipped with better security countermeasures and hence are guaranteed to be benign;2) detection performance with unknown number of compromised sensors. Numerical examples are given to illustrate the main results.The main contributions of this work are summarized as follows: 1) To the best of our knowledge, this is the first work that studies the trade-off between the efficiency and security of any inference algorithm.2) With mild assumptions on the probability distributions of the measurements, we provide the fundamental limits of the trade-off between the efficiency and security (Corollaries 1 and 2). Furthermore, we present detectors, with low computational complexity, that achieve these limits (Theorem 4). Therefore, the system operator can easily adopt the detectors we proposed to obtain the best trade-off between efficiency and security. Interestingly, in some cases, e.g., Gaussian random variables with same variance and different mean, the maximal efficiency and the maximal security can be achieved simultaneously (Theorem 5).3) Similar results, i.e., the fundamental limits of the trade-off and the detectors that possess these limits, are established with several different problem settings (Section V). This shows that our analysis techniques are insightful and may be helpful for the future related studies. Related Literature: A sensor is referred to as a Byzantine sensor if its messages to the fusion center are fully controlled by an adversary 1 . Recently, detection with Byzantine sensors has been studied extensively in [5]-[14], among which [5]-[7] took the perspective of an attacker and aimed to find the most effective attack strategy, [8]-[11] focused on designs of resilient de...