Background Concerns have been raised about the safety of surgery for stress urinary incontinence and pelvic organ prolapse using transvaginal mesh. We assessed adverse outcomes after first, single mesh procedures and comparable non-mesh procedures. Methods We did a cohort study of women in Scotland aged 20 years or older undergoing a first, single incontinence procedure or prolapse procedure during 1997–98 to 2015–16 identified from a national hospital admission database. Primary outcomes were immediate postoperative complications and subsequent (within 5 years) readmissions for later postoperative complications, further incontinence surgery, or further prolapse surgery. Poisson regression models were used to compare outcomes after procedures carried out with and without mesh. Findings Between April 1, 1997, and March 31, 2016, 16 660 women underwent a first, single incontinence procedure, 13 133 (79%) of which used mesh. Compared with non-mesh open surgery (colposuspension), mesh procedures had a lower risk of immediate complications (adjusted relative risk [aRR] 0·44 [95% CI 0·36–0·55]) and subsequent prolapse surgery (adjusted incidence rate ratio [aIRR] 0·30 [0·24–0·39]), and a similar risk of further incontinence surgery (0·90 [0·73–1·11]) and later complications (1·12 [0·98–1·27]); all ratios are for retropubic mesh. During the same time period, 18 986 women underwent a first, single prolapse procedure, 1279 (7%) of which used mesh. Compared with non-mesh repair, mesh repair of anterior compartment prolapse was associated with a similar risk of immediate complications (aRR 0·93 [95% CI 0·49–1·79]); an increased risk of further incontinence (aIRR 3·20 [2·06–4·96]) and prolapse surgery (1·69 [1·29–2·20]); and a substantially increased risk of later complications (3·15 [2·46–4·04]). Compared with non-mesh repair, mesh repair of posterior compartment prolapse was associated with a similarly increased risk of repeat prolapse surgery and later complications. No difference in any outcome was observed between vaginal and, separately, abdominal mesh repair of vaginal vault prolapse compared with vaginal non-mesh repair. Interpretation Our results support the use of mesh procedures for incontinence, although further research on longer term outcomes would be beneficial. Mesh procedures for anterior and posterior compartment prolapse cannot be recommended for primary prolapse repair. Both vaginal and abdominal mesh procedures for vaginal vault prolapse repair are associated with similar effectiveness and complication rates to non-mesh vaginal repair. These results therefore do not clearly favour any particular vault repair procedure. Funding None.