Nodding syndrome is a poorly understood neurological disorder that predominantly occurs in Africa. We hypothesised that nodding syndrome is a neuroinflammatory disorder, induced by antibodies to Onchocerca volvulus or its Wolbachia symbiont, cross-reacting with host neuronal proteins (HNPs), and that doxycycline can be used as treatment. In this randomised, double-blind, placebo-controlled, phase 2 trial, we recruited participants from districts affected by nodding syndrome in northern Uganda. We included children and adolescents aged 8-18 years with nodding syndrome, as defined by WHO consensus criteria. Participants were randomly assigned (1:1) to receive either 100 mg doxycycline daily or placebo for 6 weeks via a computer-generated schedule stratified by skin microscopy results, and all parties were masked to group assignment. Diagnoses of O volvulus and antibodies to HNPs were made using luciferase immunoprecipitation system assays and immunohistochemistry. The primary outcome was change in the proportion with antibodies to HNPs, assessed at 24 months. All participants were included in safety analyses, and surviving participants (those with samples at 24 months) were included in primary analyses. Secondary outcomes were: change in concentrations of antibodies to HNPs at 24 months compared with baseline; proportion of participants testing positive for antibodies to O volvulus-specific proteins and concentrations of Ov16 or OVOC3261 antibodies at 24 months compared with baseline; change in seizure burden, proportion achieving seizure freedom, and the proportions with interictal epileptiform discharges on the diagnostic EEG; overall quality of life; disease severity at 24 months; and incidence of all-cause adverse events, serious adverse events, and seizure-related mortality by 24 months. This trial is registered with ClinicalTrials.gov, NCT02850913. Between Sept 1, 2016, and Aug 31, 2018, 329 children and adolescents were screened, of whom 240 were included in the study. 140 (58%) participants were boys and 100 (42%) were girls. 120 (50%) participants were allocated to receive doxycycline and 120 (50%) to receive placebo. At recruitment, the median duration of symptoms was 9 years (IQR 6-10); 232 (97%) participants had O volvulus-specific antibodies and 157 (65%) had autoantibodies to HNPs. The most common plasma autoantibodies were to human protein deglycase DJ-1 (85 [35%] participants) and leiomodin-1 (77 [32%] participants) and, in cerebrospinal fluid (CSF), to human DJ-1 (27 [11%] participants) and leiomodin-1 (14 [6%] participants). On immunohistochemistry, 46 (19%) participants had CSF autoantibodies to HNPs, including leiomodin-1 (26 [11%]), γ-aminobutyric acid B receptors (two [<1%]), CASPR2 (one [<1%]), or unknown targets (28 [12%]). At 24 months, 161 (72%) of 225 participants had antibodies to HNPs compared with 157 (65%) of 240 at baseline. 6 weeks of doxycycline did not affect the concentration of autoantibodies to HNPs, seizure control, disease severity, or quality of life at the 24-month follow-up but substantially decreased Ov16 antibody concentrations; the median plasma signal-to-noise Ov16 ratio was 16·4 (95% CI 6·4-38·4), compared with 27·9 (8·2-65·8; p=0·033) for placebo. 14 (6%) participants died and, other than one traffic death, all deaths were seizure-related. Acute seizure-related hospitalisations (rate ratio [RR] 0·43 [95% CI 0·20-0·94], p=0·028) and deaths (RR 0·46 [0·24-0·89], p=0·028) were significantly lower in the doxycycline group. At 24 months, 96 (84%) of 114 participants who received doxycycline tested positive for antibodies to Ov16, compared with 97 (87%) of 111 on placebo (p=0·50), and 74 (65%) participants on doxycycline tested positive for antibodies to OVOC3261, compared with 57 (51%) on placebo (p=0·039). Doxycycline was safe; there was no difference in the incidence of grade 3-5 adverse events across the two groups. Nodding syndrome is strongly associated with O volvulus and the pathogenesis is probably mediated through an O volvulus induced autoantibody response to multiple proteins. Although it did not reverse disease symptoms, doxycycline or another prophylactic antibiotic could be considered as adjunct therapy to antiseizure medication, as it might reduce fatal complications from acute seizures and status epilepticus induced by febrile infections. Medical Research Council (UK). For the Luo translation of the abstract see Supplementary Materials section.