To assess incidence, prevalence, risk factors, and prognosis of peripartum depression and anxiety in a prospective study of women with epilepsy. Pregnancies in women with epilepsy (n=706) were compared to pregnancies in all women without epilepsy (n=106,511) including women with specified nonepileptic chronic diseases (n=8,372) in the Norwegian Mother and Child Cohort Study. The database was linked to the Medical Birth Registry of Norway. Depression and anxiety were assessed with validated questionnaires five times from the second trimester to 36 months after delivery. Blood was drawn for analysis of antiepileptic drug (AED) concentrations. Women with epilepsy more often had peripartum depression (26.7%) or anxiety (22.4%) than women without epilepsy (18.9% and 14.8%, respectively, p<0.001 for both comparisons) and women with other chronic diseases (23.1% and 18.4%, respectively, p=0.03 and 0.01). Women using AEDs during pregnancy were especially at risk regardless of AED type. The risk further increased with the use of multiple AEDs and with high doses and/or plasma levels. Risk factors associated with peripartum depression and/or anxiety in the epilepsy cohort were high seizure frequency, a history of physical and/or sexual abuse, adverse socioeconomic factors, previous loss of a child, AED use, unplanned pregnancy, and prepregnancy depression and/or anxiety. The recovery rate 3 years after delivery was lower for women with epilepsy with a history of depression/anxiety or physical/sexual abuse than for women without epilepsy. Depressed women with epilepsy were less frequently treated with antidepressive drugs during pregnancy than women without epilepsy. Women with epilepsy frequently have depression and anxiety during and after pregnancy. Patients at risk should be identified before delivery as depressive symptoms could be undertreated in this group.