The systematic detention of migrants and asylum-seekers is increasingly used as a tool to restrict the influx of migrants and refugees, affecting hundreds of thousands of migrants in host and transit countries. Medecins Sans Frontieres (MSF) has worked in immigration detention settings and has exposed the detrimental impact of detention on migrants' health. This work has also led to a series of ethical challenges related to working within an incarceration system that inherently limits efforts to alleviate suffering. The dilemmas faced by aid workers include issues of independent action, access, acceptance, and responsiveness to beneficiary needs. First, unrestricted access is impossible in prison-like facilities where daily operations are dependent on state consent. Secondly, when access is granted, MSF teams risk being perceived as part of the detention system, or at least seeming to collaborate with and accept it. Thirdly, the relevance and effectiveness of intervention is limited when the intervention setting is inherent to the suffering that humanitarian action seeks to alleviate. Such issues raise the question of when MSF's "ethic of refusal" should apply, as well as illustrating the sacrifices aid agencies have to make in difficult and restrictive conditions.