BACKGROUNDMost patients with myelofibrosis develop ruxolitinib intolerance or disease that is relapsed or refractory, and survival rates after ruxolitinib discontinuation are poor. We aimed to evaluate the safety and efficacy of fedratinib versus best available therapy (BAT) in patients with myelofibrosis previously treated with ruxolitinib.METHODSFREEDOM2 was a multicentre, open-label, randomised, controlled, phase 3 trial in 86 clinics in 16 countries, in which patients aged at least 18 years with intermediate-2 or high-risk myelofibrosis that was relapsed or refractory or intolerant to ruxolitinib with Eastern Cooperative Oncology Group performance status 0-2 were stratified by spleen size by palpation, platelet count, and previous ruxolitinib treatment, and randomly assigned 2:1 by interactive response technology to receive fedratinib 400 mg per day (4 × 100 mg capsules orally once daily, open-label) or BAT. Patients received prophylactic antiemetics and thiamine supplementation, and symptomatic antidiarrhoeals as required. Primary endpoint was proportion of patients reaching spleen volume reduction (SVR) of at least 35% (SVR35) at end of cycle 6 in the intention-to-treat population. This manuscript reports the primary analysis of the trial; follow-up is ongoing. This trial is registered at clinicaltrials.gov, NCT03952039.FINDINGSBetween Sept 9, 2019 and June 24, 2022, of 316 patients screened, 201 were randomly assigned and treated (134 to fedratinib, 67 to BAT [including 52 receiving ruxolitinib]); 46 patients from the BAT group crossed over to fedratinib. Approximately half of enrolled patients were male (fedratinib 75 [56%] of 134; BAT 30 [45%] of 67) and most were White (fedratinib 106 [79%] of 134; BAT 58 [87%] of 67). At data cutoff (Dec 27, 2022), median survival follow-up was 64·5 weeks (IQR 37·9-104·9). SVR35 at end of cycle 6 was seen in 48 (36%) of 134 patients receiving fedratinib versus four (6%) of 67 patients receiving BAT (30% difference; 95% CI 20-39; one-sided p-value <0·0001). During the first six cycles 53 (40%) of 134 patients in the fedratinib group and 8 (12%) of 67 patients in the BAT group had grade 3 or greater treatment-related adverse events, most frequently anaemia (fedratinib 12 [9%] of 134; BAT 6 [9%] of 67) and thrombocytopenia (fedratinib 16 [12%] of 134; BAT 2 [3%] of 67); one patient in the fedratinib group died from acute kidney injury suspected to be related to study drug (no treatment-related deaths in the BAT group). Gastrointestinal adverse events occurred more frequently in the fedratinib group compared with the BAT group, but were mostly grade 1-2 in severity and more frequent in early cycles, and were less frequent than in prior clinical trials. A total of 28 (21%) of 134 patients in the fedratinib group and 3 (4%) of 67 patients in the BAT group had thiamine levels below lower limit of normal per central laboratory assessment, with only one case of low thiamine in the fedratinib arm after the introduction of prophylactic thiamine supplementation.INTERPRETATIONFindings from FREEDOM2 support fedratinib as a second-line Janus kinase inhibitor option to reduce spleen size after ruxolitinib failure or intolerance in patients with myelofibrosis, and shows effective strategies for management of gastrointestinal adverse events and low thiamine concentrations through prophylaxis, monitoring, and treatment.FUNDINGBristol Myers Squibb.