Background Many patients with type 2 diabetes do not achieve sustained diabetes remission after metabolic (bariatric) surgery for the treatment of obesity. Liraglutide, a glucagon-like peptide-1 analogue, improves glycaemic control and reduces bodyweight in patients with type 2 diabetes. Our aim was to assess the safety and efficacy of liraglutide 1·8 mg in patients with persistent or recurrent type 2 diabetes after metabolic surgery. Methods In the GRAVITAS randomised double-blind, placebo-controlled trial, we enrolled adults who had undergone Roux-en-Y gastric bypass or vertical sleeve gastrectomy and had persistent or recurrent type 2 diabetes with HbA1c levels higher than 48 mmol/mol (6·5 at least 1 year after surgery from five hospitals in London, UK. Participants were randomly assigned (2:1) via a computer-generated sequence to either subcutaneous liraglutide 1·8 mg once daily or placebo, both given together with a reduced-calorie diet, aiming for a 500 kcal per day deficit from baseline energy intake, and increased physical activity. The primary outcome was the change in HbA1c from baseline to the end of the study period at 26 weeks, assessed in patients who completed the trial. Safety was assessed in the safety analysis population, consisting of all participants who received either liraglutide or placebo. This trial is registered with EudraCT, number 2014-003923-23, and the ISRCTN registry, number ISRCTN13643081. Findings Between Jan 29, 2016, and May 2, 2018, we assigned 80 patients to receive either liraglutide (n=53) or placebo (n=27). 71 (89 participants completed the study and were included in the principal complete-cases analysis. In a multivariable linear regression analysis, with baseline HbA1c levels and surgery type as covariates, liraglutide treatment was associated with a difference of −13·3 mmol/mol (−1·22 9519·7 to −7·0; p=0·0001) in HbA1c change from baseline to 26 weeks, compared with placebo. Type of surgery had no significant effect on the outcome. 24 (45 of 53 patients assigned to liraglutide and 11 (41 of 27 assigned to placebo reported adverse effects: these were mainly gastrointestinal and in line with previous experience with liraglutide. There was one death during the study in a patient assigned to the placebo group, which was considered unrelated to study treatment. Interpretation These findings support the use of adjunctive liraglutide treatment in patients with persistent or recurrent type 2 diabetes after metabolic surgery. Funding JP Moulton Foundation.