Process for separating a mixture containing hydrogen and carbon dioxide, as well as at least one compound lighter than carbon dioxide selected from the group consisting of carbon monoxide, methane and nitrogen, comprising the following steps a) Cooling of the mixture from a first temperature in a heat exchanger by feeding the mixture to the heat exchanger, causing partial condensation of the mixture into a carbon dioxide-enriched liquid phase and a carbon dioxide-depleted gaseous phase, the mixture leaving the heat exchanger at a second temperature lower than the first temperature, said heat exchanger being at least partially cooled by a gaseous fluid which heats up in the heat exchanger by indirect heat exchange b) Separation of the liquid phase from the gaseous phase in one or more separator pots, possibly in several stages interspersed with successive cooling phases. c) Heating at least part of the gas phase coming from at least one of the separator pots in the heat exchanger by indirect heat exchange. d) The at least one heated part from step c) is sent to a membrane separation unit as the sole feed flow to the membrane separation unit,generating one or more permeates enriched in hydrogen and/or carbon dioxide and depleted in at least one compound lighter than carbon dioxide with respect to the heated part, and at least one residue depleted in hydrogen and carbon dioxide and enriched in at least one compound lighter than carbon dioxide with respect to the heated part and characterised in that it comprises e) Expansion of at least one residue from a first pressure in one or more turbines producing an expanded fluid to a second pressure lower than the first pressure and to a third temperature lower than the first temperature and preferably at or below the second temperature, f) The fluid at the second pressure produced in step e) constitutes the gaseous fluid from step a), which heats up in the heat exchanger by indirect heat exchange. with the mixture and g) the at least one residue is sent from the membrane separation unit to the turbine or turbines without passing through the heat exchanger. a) Cooling of the mixture from a first temperature in a heat exchanger by feeding the mixture to the heat exchanger, causing partial condensation of the mixture into a carbon dioxide-enriched liquid phase and a carbon dioxide-depleted gaseous phase, the mixture leaving the heat exchanger at a second temperature lower than the first temperature, said heat exchanger being at least partially cooled by a gaseous fluid which heats up in the heat exchanger by indirect heat exchange b) Separation of the liquid phase from the gaseous phase in one or more separator pots, possibly in several stages interspersed with successive cooling phases. c) Heating at least part of the gas phase coming from at least one of the separator pots in the heat exchanger by indirect heat exchange. d) The at least one heated part from step c) is sent to a membrane separation unit as the sole feed flow to the membrane separation unit,generating one or more permeates enriched in hydrogen and/or carbon dioxide and depleted in at least one compound lighter than carbon dioxide with respect to the heated part, and at least one residue depleted in hydrogen and carbon dioxide and enriched in at least one compound lighter than carbon dioxide with respect to the heated part and characterised in that it comprises e) Expansion of at least one residue from a first pressure in one or more turbines producing an expanded fluid to a second pressure lower than the first pressure and to a third temperature lower than the first temperature and preferably at or below the second temperature, f) The fluid at the second pressure produced in step e) constitutes the gaseous fluid from step a), which heats up in the heat exchanger by indirect heat exchange. with the mixture and g) the at least one residue is sent from the membrane separation unit to the turbine or turbines without passing through the heat exchanger.