An energy-efficient method for producing purified, compressed carbon dioxide suitable for enhanced oil or gas recovery (EOR/EGR) and electricity from a gaseous hydrocarbon feed using a SOFC system, the method comprising the steps of: - introducing the gaseous hydrocarbon feed into the SOFC system, wherein the gaseous hydrocarbon feed is a sweet gas or wherein the SOFC system is operating such that the SOFC system generates a sweet gas; - adding a recycled anode off gas comprising hot steam to the sweet gas; - introducing the sweet gas comprising hot steam into a reformer of the SOFC system; - in the reformer, generating a reformed process gas by at least partially converting methane and steam into carbon monoxide and hydrogen; - passing the reformed process gas from the reformer into the solid oxide fuel cell; - in the solid oxide fuel cell, converting hydrogen and carbon monoxide of the reformed process gas in combination with oxygen into an anode off-gas comprising steam and carbon dioxide and into a depleted air; - separating the anode off-gas into a recycled anode off-gas and a remaining off-gas; - cooling the recycled anode off-gas down to a temperature in the range of above condensation temperature and 200 °C and, after cooling, pumping the recycled anode off gas (304, 306), - recycling the recycled anode off-gas above condensation temperature to provide the recycled anode off gas comprising hot steam; - passing the remaining anode off-gas into a water-gas shift unit; - in the water-gas shift unit, converting carbon monoxide and steam into carbon dioxide and hydrogen, to create a shifted anode off-gas; - passing the shifted anode off-gas from the water-gas shift unit into a separation system; - in the separation system, separating carbon dioxide from the shifted anode off-gas, wherein the carbon dioxide is compressed in a compressor (403, 415) to provide compressed carbon dioxide. - introducing the gaseous hydrocarbon feed into the SOFC system, wherein the gaseous hydrocarbon feed is a sweet gas or wherein the SOFC system is operating such that the SOFC system generates a sweet gas; - adding a recycled anode off gas comprising hot steam to the sweet gas; - introducing the sweet gas comprising hot steam into a reformer of the SOFC system; - in the reformer, generating a reformed process gas by at least partially converting methane and steam into carbon monoxide and hydrogen; - passing the reformed process gas from the reformer into the solid oxide fuel cell; - in the solid oxide fuel cell, converting hydrogen and carbon monoxide of the reformed process gas in combination with oxygen into an anode off-gas comprising steam and carbon dioxide and into a depleted air; - separating the anode off-gas into a recycled anode off-gas and a remaining off-gas; - cooling the recycled anode off-gas down to a temperature in the range of above condensation temperature and 200 °C and, after cooling, pumping the recycled anode off gas (304, 306), - recycling the recycled anode off-gas above condensation temperature to provide the recycled anode off gas comprising hot steam; - passing the remaining anode off-gas into a water-gas shift unit; - in the water-gas shift unit, converting carbon monoxide and steam into carbon dioxide and hydrogen, to create a shifted anode off-gas; - passing the shifted anode off-gas from the water-gas shift unit into a separation system; - in the separation system, separating carbon dioxide from the shifted anode off-gas, wherein the carbon dioxide is compressed in a compressor (403, 415) to provide compressed carbon dioxide.