Inclusion criteria:  Participants are eligible to be included in the study only if all the following criteria apply:  Informed consent obtained before any study-related activities. Study-related activities are any procedures that are carried out as part of the study, including activities to determine suitability for the study. Male or female, age above or equal to 18 years at the time of signing informed consent Body mass index (BMI) of greater than or equal to 27.0 kg/m^2 with greater than or equal to 2 weight related comorbidities (treated or untreated) according to the JASSO guideline or BMI greater than or equal to 35.0 kg/m^2 with greater than or equal to1 weight related comorbidity (treated or untreated) according to the JASSO guideline. At least one comorbidity should be hypertension, dyslipidaemia or type 2 diabetes (T2D) History of at least one self-reported unsuccessful dietary effort to lose body weight  For participants with T2D at screening the following inclusion criteria apply in addition to criteria 1-4:  Diagnosed with T2D greater than or equal to 180 days prior to screening Treated with either diet and exercise alone or stable treatment (same drug(s), dose and dosing frequency) for at least 60 days prior to the day of screening with up to 3 oral antidiabetic drugs (OADs) alone or in any combination (metformin, α-glucosidase (AGI), sulphonylureas (SU), glinides, SGLT2i (sodium-glucose co-transporter 2 inhibitor) or thiazolidinediones) HbA1c 7.0-10.0% (53-86 mmol/mol) (both inclusive) as measured by central laboratory at screening  Exclusion criteria:  Participants without T2D only:  HbA1c greater than or equal to 6.5% (48 mmol/mol) as measured by the central laboratory at screening History of type 1 or type 2 diabetes Treatment with glucose-lowering agent(s) within 90 days prior to screening Renal impairment measured as estimated Glomerular Filtration Rate (eGFR) value of eGFR brlow 15 ml/min/1.73 m^2 according to Chronic Kidney Disease Epidemiology Collaboration (CKD-EPI) creatinine equation as defined by kidney disease improving global outcomes (KDIGO) 2012 classification by the central laboratory at screening  Participants with T2D at screening only:  Treatment with any medication for the indication of diabetes other than stated in the inclusion criteria within the past 60 days prior to screening Receipt of any other anti-diabetic investigational drug within 90 days prior to screening for this study, or receipt of any investigational drugs not affecting diabetes within 30 days prior to screening for this study Uncontrolled and potentially unstable diabetic retinopathy or maculopathy. Verified by a fundus examination performed by an ophthalmologist or another suitably qualified health care provider within the past 90 days prior to screening or in the period between screening and randomisation. Pharmacological pupil-dilation is a requirement unless using a digital fundus photography camera specified for non-dilated examination. Renal impairment measured as eGFR value of below 30 mL/min/1.73 m^2 according to CKD EPI creatinine equation as defined by KDIGO 2012 classification by the central laboratory at screening In participants treated with SGLT2i, renal impairment measured as eGFR value of below 60 mL/min/1.73 m^2 according to CKD EPI creatinine equation as defined by KDIGO 2012 classification by the central laboratory at screening  The following criteria apply to all participants:  Obesity-related:  Treatment with any medication indicated for weight management within 90 days prior to screening Previous or planned (during the study period) obesity treatment with surgery or a weight loss device. However, the following are allowed: (1) liposuction and/or abdominoplasty, if performed greater than 1 year prior to screening, (2) lap banding, if the band has been removed greater than 1 year prior to screening, (3) intragastric balloon, if the balloon has been removed greater than 1 year prior to screening or (4) duodenal-jejunal bypass sleeve, if the sleeve has been removed greater than 1 year prior to screening Uncontrolled thyroid disease per investigators discretion A self-reported change in body weight greater than 5 kg (11 lbs) within 90 days before screening irrespective of medical records