In the Cold War, Rabat's pro-Western monarchy stood in stark contrast to the Soviet-friendly Algiers, where successive governments spent 30 years toying with socialism, Arabisation, authoritarianism, collectivisation, and Islamism.
In the 1970s, Algeria began backing the Polisario Front, which claimed sovereignty over Western Sahara, over which Morocco also claimed sovereignty after former colonial ruler Spain withdrew from the continent. In the 1990s, shortly after Algeria had descended into a bloody civil war, the Algeria-Morocco land border was closed and has remained so ever since.
There was no thaw after Tebboune became president in 2019. Morocco is alleged to have used Israeli spyware named Pegasus to snoop on the phones of around 6,000 high-ranking Algerians, including army generals. Rabat claims innocence. It may also have been innocent when Morocco's ambassador to the United Nations called for self-determination in the mountainous Algerian coastal region of Kabylie, which has a large Berber population.
Pipeline posturing
Yet the pair have fallen out most dramatically over gas. Algeria closed a pipeline that ran through Morocco to Spain, annoyed that Rabat—itself a major customer of Algerian gas—was taking a 7% commission. Bypassing Morocco, Algeria continued pumping gas to Spain via a direct underwater pipeline, but when Morocco asked Spain if it could have some of its Algerian gas south, Algiers threatened to stop supplying Spain, too.
Pipelines are still an issue today, most notably the Nigerian Trans-Saharan gas pipeline, which would send up to 30 billion cubic metres of Nigerian gas up through the Sahel to Algeria, where it would connect to existing pipes for Europe.
"Algeria has been considering its project since the 1970s, whereas Morocco entered the fray this century," says Kahi, who also cited the Trans-Saharan Road (TSR) corridor from Lagos in Nigeria to Algiers.
"This aims to connect West Africa with North Africa, linking the Sahel countries to Mediterranean ports and integrating into the Chinese Silk Road initiative," says Kahi.
"Conversely, Morocco proposed an initiative to allow Sahel countries access the Atlantic, confirming its efforts to compete with Algeria, which currently enjoys considerable influence in Africa, despite having a narrower margin for manoeuvre."
Read more: Not just a 'pipe' dream, Morocco-Nigeria gas line set to transform Africa
Kahi said both sides were using the animosity. "Morocco is manipulating the competition to advance its objectives and strengthen its stance on Western Sahara. Algeria is using it to promote regional stability and the development of the Sahel."
Alliance jostling
Yet Abdel Rafiq Kashout, a politics professor of politics at the University of Jijel, says it "should not be termed as competition, but rather as a Moroccan struggle against Algeria's expanding influence in Africa".
Kashout thinks the current polarisation across Africa has led to Algerian proposals receiving mixed responses. While Algeria advocates for Africa's wealth to be channelled back to its people, Kashout explains, Morocco favours a different approach that involves Western companies who would bring advanced technology and access to finance.
This aligns with Morocco's strategy of investing heavily in Africa. Rabat has also sought membership in regional bodies, such as ECOWAS (the Economic Community of West African States). Morocco is also a member of the Arab Maghreb Union, as is Algeria, but disagreements between the two led to the union becoming moribund.
Morocco withdrew from the African Union (AU) in 1984 over a disagreement about Western Sahara but was readmitted in 2017. Kashout suggested that Algeria's influence in the AU may have been a primary motivator for Rabat. He says the influence of traditional powers like France has waned, which has provided Algeria and Morocco with opportunities to fill the void and seek a leadership role.
Read more: Eye on Niger: Who will win in a multipolar contest for Africa influence?
Patterns repeating
In this context, Algerian influence is seen in its successful diplomatic interventions, including its help in resolving the Ethiopia-Eritrea conflict and concerns over the impact of Ethiopia's 2022 Renaissance Dam on Egypt and Sudan.
The resumption of armed conflict in Western Sahara in November has stoked Moroccan-Algerian rivalry yet again, says former MP Mohamed Hadibi, with Israel's supply of drones and tanks to Morocco having helped it weaken the Polisario Front.