AIMS: Atrial fibrillation (AF) is a risk factor for brain infarction, which can lead to epilepsy. We aimed to investigate whether treatment of AF with direct oral anticoagulants (DOACs) affects the risk of epilepsy in comparison to treatment with the vitamin K antagonist phenprocoumon (PPC). METHODS AND RESULTS: We performed an active comparator, nested case-control study based on the German Pharmacoepidemiological Research Database that includes claims data from statutory health insurance providers of about 25 million persons since 2004. In 2011-17, 227 707 AF patients initiated treatment with a DOAC or PPC, of which 1828 cases developed epilepsy on current treatment with an oral anticoagulant. They were matched to 19 084 controls without epilepsy. Patients with DOAC treatment for AF had an overall higher risk of epilepsy with an odds ratio of 1.39, 95% CI (1.24; 1.55) compared to current PPC treatment. Cases had higher baseline CHA2DS2-VASc scores and more frequently a history of stroke than controls. After excluding patients with ischaemic stroke prior to the diagnosis of epilepsy, the risk of epilepsy was still higher on DOACs than on PPC. In contrast, within a cohort of patients with venous thromboembolism, the risk of epilepsy on treatment with DOACs was less elevated [adjusted odds ratio 1.15, 95% CI (0.98; 1.34)]. CONCLUSION: In patients with AF initiating oral anticoagulation, treatment with a DOAC was associated with an increased risk of epilepsy compared to the vitamin K antagonist PPC. Covert brain infarction may explain the observed elevated risk of epilepsy