Type 1 diabetes (T1D) is caused by the autoimmune destruction of pancreatic beta cells. Pluripotent stem cells can now be differentiated into beta cells, thus raising the prospect of a cell replacement therapy for T1D. However, autoimmunity would rapidly destroy newly transplanted beta cells. Using a genome-scale CRISPR screen in a mouse model for T1D, we show that deleting RNLS, a genome-wide association study candidate gene for T1D, made beta cells resistant to autoimmune killing. Structure-based modelling identified the U.S. Food and Drug Administration-approved drug pargyline as a potential RNLS inhibitor. Oral pargyline treatment protected transplanted beta cells in diabetic mice, thus leading to disease reversal. Furthermore, pargyline prevented or delayed diabetes onset in several mouse models for T1D. Our results identify RNLS as a modifier of beta cell vulnerability and as a potential therapeutic target to avert beta cell loss in T1D.