In the cloudlet architecture of Mobile Cloud Computing (MCC), a number of heavy jobs are offloaded to a private and local cloud, known as cloudlet, to overcome the lack of battery and computation resources of mobile devices. In this architecture, the cloudlet with the help of some public clouds provides the computational resources in the form of virtual machines (VMs) on physical machines (PMs). The users’ requests, based on their security requirements, are classified into different levels which require a certain number of PMs and VMs. On the other hand, the financial budgets of the cloudlet to afford these computational resources are restricted. In addition to the mentioned trade-off between security and cost, other trade-offs emerge among some components of the cost. For example, utilizing a large number of PMs of the cloudlet and public clouds decreases the penalty cost of request rejection; however, other associated costs, such as infrastructure, power consumption, and cooling, augment significantly. Therefore, to minimize the overall cost and to guarantee the security requirements, finding the optimal number of required PMs in all participant clouds, including the cloudlet and public clouds, is recognized as an important issue. To deal with this issue, in the current paper, a security and cost-aware resource allocation (SeCARA) method is proposed. Specifically, the proposed method converts this issue into two cost optimization problems. To compute the components of the cost, the proposed method exploits an analytical performance-security model of a cloudlet to obtain some necessary performance measures, such as request rejection probability. To achieve these significant measures, Markov reward model (MRM) is appropriately used by the performance-security model. Moreover, simulated annealing algorithms are applied to solve the optimization problems. Numerical results demonstrate the strength of the proposed method to identify the optimal number of PMs, for different security types of requests, within an acceptable duration of the time.