Algeria has been busy building one of the world's largest mosques which officials say will serve as a buffer against the rise of militant groups like al-Qaeda.

The mosque is being touted as the crowning legacy of ailing President Abdelaziz Bouteflika, who is now aged 79 and has been in poor health since 2013 when he suffered a stroke.

The Djamaa El Djazair mosque is being built facing the picturesque bay of Algiers as part of a complex that will include a one-million book library, a Quranic school and a museum of Islamic art and history.

It will also have the world’s tallest minaret, standing 265 metres, as well as a 20,000 square-metres prayer hall capable of accommodating up to 120,000 worshippers. Algeria has a population of almost 40 million people.

Authorities are trying to brand the project as an anti-extremism venture that will be a “heavy blow for the extremists”.

“Some have accused us of building a temple for the extremists but on the contrary, it will be a heavy blow for the extremists,” Ahmed Madani, an adviser to the minister of housing responsible for the construction, told AFP. “They are the ones hostile to this project."

"[The mosque will be] an emblem of moderate Islam in Algeria and a shield against all forms of extremism," said Madani.

The complex is being constructed by a Chinese firm and is due to be completed in 2017. It will be located between a future tourist hotspot and working class districts that were once seen as a breeding ground for militants.

The North African country was battered by a civil war in the 1990s between the government and supporters of the Islamic Salvation Front that killed some 200,000 people.

More than two decades later, armed groups remain active in parts of Algeria and the country has been hit by several devastating attacks claimed by al-Qaeda in recent years.

'Faith and culture'

According to Madani, Algerian officials have been mulling the idea of building a mega-mosque since 1962, the year Algeria gained its independence from France.

"The dream started becoming a reality" after the election of Bouteflika, a man known for his piety and devotion to Muslim art and culture, Madani said.

Bouteflika has been in power since 1999. He is respected by many for his role in ending the civil war but his opponents and rights groups accuse him of having an authoritarian streak and clamping down on any political opposition.

The new mosque "will not only serve as a house of worship. It will be a place where links between faith and culture will be reinforced thanks to its ultra-modern library and the Koranic school which will be open to some 300 students," said Madani.

Oil-rich Algeria is already home to more than 30,000 mosques.

The construction of Djamaa El Djazair - dubbed "Bouteflika Mosque" by some - was launched in 2012, when oil prices were high, said Housing Minister Abdeladjid Tebboune.

Four years later, Algeria is facing revenue shortages due to weaker oil prices and its foreign exchange reserves have fallen.

The new mosque complex has a price tag of 1.2 bn euros ($1.4 bn), with online critics saying the cost is "mind-boggling" and that the money should have been used to build hospitals and improve health care.

An aerial view taken on 26 April, 2016 of the mosque (AFP)

Risk of earthquakes?

Experts questioned by AFP have bemoaned what many have described as an "unsound" project, and warned that the cost of this mammoth construction could further grow if deadlines are not met.

"Most of the work is far from over and it will take a lot of time to finish everything," said an architect, referring to technical installations as well mural decorations including calligraphy that is still unfinished.

The mosque will be equipped with solar panels and a sophisticated system to retain rain water which will then be recycled for other uses.

Experts have also warned against the risks of the mosque being destroyed in an earthquake.

Algeria sits astride two major plates and is regularly hit by earthquakes, especially along the Mediterranean coast.

A 2003 earthquake that hit the coastal town of Boumerdes to the east of Algiers killed nearly 3,000 people and injured 10,000.

Earthquake expert Abdelakrim Chelghoum has told authorities that a seismic study conducted by a German firm underestimated the risk of an earthquake damaging the mosque.

But Madani has dismissed the concern.

He said a mechanism capable of absorbing earth movements has been put into place and could decrease the effect of a magnitude 9 quake to that of a 3.5 tremor.