BACKGROUND:Patent foramen ovale (PFO) is a contributor to embolic stroke of undetermined source (ESUS). Subgroup analyses from previous studies suggest that anticoagulation could reduce recurrent stroke compared with antiplatelet therapy. We hypothesised that anticoagulant treatment with rivaroxaban, an oral factor Xa inhibitor, would reduce the risk of recurrent ischaemic stroke compared with aspirin among patients with PFO enrolled in the NAVIGATE ESUS trial. METHODS:NAVIGATE ESUS was a double-blinded, randomised, phase 3 trial done at 459 centres in 31 countries that assessed the efficacy and safety of rivaroxaban versus aspirin for secondary stroke prevention in patients with ESUS. For this prespecified subgroup analysis, cohorts with and without PFO were defined on the basis of transthoracic echocardiography (TTE) and transoesophageal echocardiography (TOE). The primary efficacy outcome was time to recurrent ischaemic stroke between treatment groups. The primary safety outcome was major bleeding, according to the criteria of the International Society of Thrombosis and Haemostasis. The primary analyses were based on the intention-to-treat population. Additionally, we did a systematic review and random-effects meta-analysis of studies in which patients with cryptogenic stroke and PFO were randomly assigned to receive anticoagulant or antiplatelet therapy. FINDINGS:Between Dec 23, 2014, and Sept 20, 2017, 7213 participants were enrolled and assigned to receive rivaroxaban (n=3609) or aspirin (n=3604). Patients were followed up for a mean of 11 months because of early trial termination. PFO was reported as present in 534 (7·4%) patients on the basis of either TTE or TOE. Patients with PFO assigned to receive aspirin had a recurrent ischaemic stroke rate of 4·8 events per 100 person-years compared with 2·6 events per 100 person-years in those treated with rivaroxaban. Among patients with known PFO, there was insufficient evidence to support a difference in risk of recurrent ischaemic stroke between rivaroxaban and aspirin (hazard ratio [HR] 0·54; 95% CI 0·22-1·36), and the risk was similar for those without known PFO (1·06; 0·84-1·33; pinteraction=0·18). The risks of major bleeding with rivaroxaban versus aspirin were similar in patients with PFO detected (HR 2·05; 95% CI 0·51-8·18) and in those without PFO detected (HR 2·82; 95% CI 1·69-4·70; pinteraction=0·68). The random-effects meta-analysis combined data from NAVIGATE ESUS with data from two previous trials (PICSS and CLOSE) and yielded a summary odds ratio of 0·48 (95% CI 0·24-0·96; p=0·04) for ischaemic stroke in favour of anticoagulation, without evidence of heterogeneity. INTERPRETATION:Among patients with ESUS who have PFO, anticoagulation might reduce the risk of recurrent stroke by about half, although substantial imprecision remains. Dedicated trials of anticoagulation versus antiplatelet therapy or PFO closure, or both, are warranted. FUNDING:Bayer and Janssen.