French President Emmanuel Macron waits for the arrival of Panama's President Jose Raul Mulino for a meeting at The Elysee Presidential Palace in Paris on October 21, 2024. [AFP]

French President Emmanuel Macron will head to Morocco next week for a three-day state visit, the Moroccan royal palace said Monday, following years of strained relations.

"This visit reflects the depth of bilateral relations based on a deep-rooted and solid partnership," the palace said.

Macron, who will arrive on October 28, was invited to the North African country by Moroccan King Mohammed VI in late September.

The monarch had called the visit -- the second since 2018 -- an opportunity for "a renewed and ambitious vision covering several strategic sectors".

Tensions between Paris and Rabat have risen in recent years over France's ambiguous stance on the disputed Western Sahara and Macron's quest for a rapprochement with Algeria.

A 2023 statement by the European Parliament condemning a rollback in the kingdom's freedom of the press also ramped up tensions, with some blaming Paris.

The two countries were also at odds after France halved the number of visas it granted to Moroccans in 2021, a decision that was revoked the following year.

Western Sahara, a former Spanish colony, is largely controlled by Morocco but claimed by the Algeria-backed Polisario Front, which in 2020 declared a "self-defence war" and seeks the territory's independence.

Macron in July eased tensions between the countries, saying Morocco's autonomy plan for the territory was the "only basis" to resolve the decades-old conflict.

"The present and future of Western Sahara are part of Moroccan sovereignty," Macron said in a statement.

France's diplomatic turnabout had been awaited by Morocco, whose annexation of Western Sahara had already been recognised by the United States in return for Rabat's normalising ties with Israel in 2020.

The United Nations considers Western Sahara a "non-self-governing territory" and has had a peacekeeping mission there since 1991 whose stated aim is to organise a referendum on the territory's future.

But Rabat has repeatedly rejected any vote in which independence is an option.

After Macron's statement endorsing Morocco's autonomy plan, the Polisario Front promptly withdrew its ambassador to Paris and has yet to replace him.

Rabat and Paris also hope that thawing relations will pave the way for economic deals -- including in Western Sahara.

French engineering company Egis is set to extend the high-speed rail line between the Moroccan cities of Kenitra and Marrakesh.

In Western Sahara, French energy company Engie has been contracted to build a water desalination plant and a wind farm.