Abstract: A method for producing clean water and electricity, in which water to be cleaned undergoes membrane distillation through one or several units (1) including a first wall (2) that is impermeable to water and has the form of a sheet, a membrane (3) through which water in the gaseous phase can pass, and through which water in fluid phase cannot pass, and a second wall (4) in the form of a sheet. The walls are located on different sides of and at a certain distance from the membrane (3), where water is led in between the first wall (2) and the membrane (3),and where the second wall is caused to be colder than the water. The first wall (2) acts as a solar cell panel (8) with electrically active layers (9) facing away from the membrane, and the solar cell panel is located such that it is illuminated by sunlight.