The village of Tadmamet is just an hour’s drive south from the bustling city of Marrakech in Morocco. But it’s a world apart.

Nestled in the High Atlas mountains, its 400 inhabitants here are 40km (25 miles) away from the nearest village and live a simple, rural lifestyle.

Crops like barley, potatoes and apples are the main source of income. Most people don’t have cars. There are no smartphones to be seen and no internet connections. Even access to electricity can be a struggle, especially during the harsh winter.

But there may be a new way to meet their energy needs. And it’s from an unlikely source: the village’s place of worship, the mosque.

Last year, Tadmamet made news: it became home to the first solar-powered mosque in the country built from scratch. The roof is covered in photovolaic solar panels, which produce so much energy, it doesn't just power the mosque – and the house of the imam next door – but also parts of the greater village.

“It’s the first positive energy mosque in the country,” says Jan-Christoph Kuntze of the German Corporation for International Cooperation (GIZ), a German government agency that provided support for the undertaking.

The Tadmamet mosque is unique, and it's paving the way for other mosques of its kind. It’s part of the ‘green mosque’ project, an initiative launched by the Moroccan government three years ago, which aims to reduce the energy use of public buildings – starting with the country’s 51,000 mosques.

In mosques, lighting consumes the most energy, followed by power required for smaller daily tasks, like sound equipment used at prayer time and vacuum cleaning.

"The energy consumption of mosques isn't as complex as other buildings, so it’s a good place to start," says Kuntze.