Multiple sclerosis (MS) lesions that do not resolve in the months after they form harbour ongoing demyelination and axon degeneration, and are identifiable in vivo by their paramagnetic rims on MRI scans1-3. Here, to define mechanisms underlying this disabling, progressive neurodegenerative state4-6 and foster development of new therapeutic agents, we used MRI-informed single-nucleus RNA sequencing to profile the edge of demyelinated white matter lesions at various stages of inflammation. We uncovered notable glial and immune cell diversity, especially at the chronically inflamed lesion edge. We define ‘microglia inflamed in MS’ (MIMS) and ‘astrocytes inflamed in MS’, glial phenotypes that demonstrate neurodegenerative programming. The MIMS transcriptional profile overlaps with that of microglia in other neurodegenerative diseases, suggesting that primary and secondary neurodegeneration share common mechanisms and could benefit from similar therapeutic approaches. We identify complement component 1q (C1q) as a critical mediator of MIMS activation, validated immunohistochemically in MS tissue, genetically by microglia-specific C1q ablation in mice with experimental autoimmune encephalomyelitis, and therapeutically by treating chronic experimental autoimmune encephalomyelitis with C1q blockade. C1q inhibition is a potential therapeutic avenue to address chronic white matter inflammation, which could be monitored by longitudinal assessment of its dynamic biomarker, paramagnetic rim lesions, using advanced MRI methods.