People with epilepsy have a 5-fold increased risk of suicide. Less is known about attempted suicide and whether psychiatric disorders and antiepileptic drugs modify the risk of attempted suicide. To estimate the magnitude of the association between attempted suicide and epilepsy by comparing a first suicide attempt and a second suicide attempt (hereafter referred to as a recurrent suicide attempt) among people before they received a diagnosis of epilepsy (case patients) with a first suicide attempt and a recurrent suicide attempt among people without epilepsy (control patients), and to evaluate the effect of comorbid psychiatric disorders and the exclusion of antiepileptic drug prescriptions on this association. Population-based retrospective cohort study in the United Kingdom of case patients with incident epilepsy and control patients without a history of epilepsy in a general practice setting using Clinical Practice Research Datalink. The case patients with incident epilepsy were identified between 1987 and 2013 and were 10 to 60 years of age. The control patients for each case patient were 4 randomly selected people who did not receive a diagnosis of epilepsy before the case patient's epilepsy was diagnosed (the index date), matched by year of birth, sex, and general practice for a control to case ratio of 4 to 1. Hazard ratio for incident and recurrent suicide attempts among case patients with epilepsy compared with control patients without. For 14,059 case patients (median age, 36 years [range, 10-60 years]) who later had an onset of epilepsy vs 56,184 control patients (median age, 36 years [range, 10-60 years]), the risk was increased 2.9-fold (95% CI, 2.5- to 3.4-fold) for a first suicide attempt during the time period before the case patients received a diagnosis of epilepsy. For 278 case patients (median age, 37 years [range, 10-61 years]) who later had an onset of epilepsy vs 434 control patients (median age, 35 years [range, 11-61 years]), the risk was increased 1.8-fold (95% CI, 1.3- to 2.5-fold) for a recurrent suicide attempt up to and including the day that epilepsy was diagnosed. Exclusion of antiepileptic drugs prescribed before the index date did not meaningfully alter the findings, nor did separate analyses of patients with and patients without diagnosed psychiatric disorders. Suicide attempts and recurrent suicide attempts are associated with epilepsy even before epilepsy manifests, suggesting a common underlying biology. Our findings indicate that both incident and recurrent suicide attempts are associated with incident epilepsy in the absence of antiepileptic drugs and in the absence of diagnosed psychiatric disorders, further strengthening the evidence for a common underlying etiology with an as-yet-unknown mechanism.