In this paper, we develop a heterogeneous agent general equilibrium framework to analyze optimal joint policies of a lockdown and transfer payments in times of a pandemic. In our model, the effectiveness of a lockdown in mitigating the pandemic depends on endogenous compliance. A more stringent lockdown deepens the recession which implies that poorer parts of society find it harder to subsist. This reduces their compliance with the lockdown, and may cause deprivation of the very poor, giving rise to an excruciating trade-off between saving lives from the pandemic and from deprivation. Lump-sum transfers help mitigate this trade-off. We identify and discuss key trade-offs involved and provide comparative statics for optimal policy. We show that, ceteris paribus, the optimal lockdown is stricter for more severe pandemics and in richer countries. We then consider a government borrowing constraint and show that limited fiscal space lowers the optimal lockdown and welfare, and increases the aggregate death burden during the pandemic. We finally discuss distributional consequences and the political economy of fighting a pandemic.