There is an unmet need for effective therapies in pretreated advanced biliary tract cancer. We aimed to evaluate the efficacy of nanoliposomal irinotecan and fluorouracil plus leucovorin compared with fluorouracil plus leucovorin as second-line treatment for biliary tract cancer. NALIRICC was a multicentre, open-label, randomised, phase 2 trial done in 17 German centres for patients aged 18 years or older, with an Eastern Cooperative Oncology Group performance status of 0-1, metastatic biliary tract cancer, and progression on gemcitabine-based therapy. Patients were randomly assigned (1:1) to receive intravenous infusions of nanoliposomal irinotecan (70 mg/m2), fluorouracil (2400 mg/m2), and leucovorin (400 mg/m2) every 2 weeks (nanoliposomal irinotecan group) or fluorouracil (2400 mg/m2) plus leucovorin (400 mg/m2) every 2 weeks (control group). Randomisation was by permutated block randomisation in block sizes of four, stratified by primary tumour site. Investigator-assessed progression-free survival was the primary endpoint, which was evaluated in all randomly assigned patients. Secondary efficacy outcomes were overall survival, objective response rate, and quality of life. Safety was assessed in all randomly assigned patients who received at least one dose of the study treatment. Enrolment for this trial has been completed, and it is registered with ClinicalTrials.gov, NCT03043547. Between Dec 4, 2017, and Aug 2, 2021, 49 patients were randomly assigned to the nanoliposomal irinotecan group and 51 patients to the control group. Median age was 65 years (IQR 59-71); 45 (45%) of 100 patients were female. Median progression-free survival was 2·6 months (95% CI 1·7-3·6) in the nanoliposomal irinotecan group and 2·3 months (1·6-3·4) in the control group (hazard ratio [HR] 0·87 [0·56-1·35]). Median overall survival was 6·9 months (95% CI 5·3-10·6) in the nanoliposomal irinotecan group and 8·2 months (5·4-11·9) in the control group (HR 1·08 [0·68-1·72]). The objective response rate was 14% (95% CI 6-27; seven patients) in the nanoliposomal irinotecan group and 4% (1-14; two patients) in the control group. The most common grade 3 or worse adverse events in the nanoliposomal irinotecan group were neutropenia (eight [17%] of 48 vs none in the control group), diarrhoea (seven [15%] vs one [2%]), and nausea (four [8%] vs none). In the control group, the most common grade 3 or worse adverse events were cholangitis (four [8%] patients vs none in the nanoliposomal irinotecan group) and bile duct stenosis (four [8%] vs three [6%]). Treatment-related serious adverse events occurred in 16 (33%) patients in the nanoliposomal irinotecan group (grade 2-3 diarrhoea in five patients; one case each of abdominal infection, acute kidney injury, pancytopenia, increased blood bilirubin, colitis, dehydration, dyspnoea, infectious enterocolitis, ileus, oral mucositis, and nausea). One (2%) treatment-related serious adverse event occurred in the control group (worsening of general condition). Median duration until deterioration of global health status, characterised by the time from randomisation to the initial observation of a score decline exceeding 10 points, was 4·0 months (95% CI 2·2-not reached) in the nanoliposomal irinotecan group and 3·7 months (2·7-not reached) in the control group. The addition of nanoliposomal irinotecan to fluorouracil plus leucovorin did not improve progression-free survival or overall survival and was associated with higher toxicity compared with fluorouracil plus leucovorin. Further research is necessary to define the role of irinotecan-based combinations in second-line treatment of biliary tract cancer. Servier and AIO-Studien.