BAMAKO (Reuters) - Rival armed groups in northern Mali agreed to the return of a state governor to the desert city of Kidal for the first time in years as part of a ceasefire deal signed on Wednesday after weeks of fighting.

The return of Governor Sidi Mohamed Ag Ichrach follows a truce among fighters drawn mostly from competing Tuareg clans involved in remote desert battles since July that have killed dozens.

The clashes have undermined a Western-backed peace process in the country and complicated efforts to counter al Qaeda-linked militants.

Radhia Achouri, spokeswoman for the United Nations mission in Mali, said the truce had been agreed between CMA, an alliance of separatist groups seeking autonomy for a region of northern Mali, and Platform, their pro-government opponents.

The deal signed in the capital Bamako amid jokes and handshakes envisages a ceasefire for an initial period of 15 days. The U.N. and Mali’s government helped broker it.

“We hope that his (Ag Ichrach’s) presence in Kidal will contribute to advancing the implementation of the peace agreement and addressing populations’ needs,” Achouri said.

The latest upsurge in fighting around the strategic city of Kidal, which lies on a nexus of desert trade routes, marks the resumption of decades-old score-settling between the semi-nomadic clans that has continued despite a 2015 peace agreement.

Mediators at the time said that the peace accord would allow Malian and French troops to counter an Islamist insurgency led by jihadists who briefly seized north Mali in 2012. Instead, their attacks on Western and Malian targets have increased.

Interim state authorities have already returned to other north Malian towns as part of the implementation of the deal. But progress had stalled over Kidal, which is prized by both sides and has changed hands several times.

There has been no permanent state presence in Kidal since 2014, when the governor fled after a visiting government delegation came under fire from angry CMA fighters.

International Committee of the Red Cross field coordinator Assem Elessawy told Reuters thousands of people had been displaced by fighting that resumed in July, and has since led to the CMA seizing back significant territory from its rivals.

Forty people injured in the battles have been treated in hospitals in Gao and Kidal, Elessawy added.

Senior CMA official Attaye Ag Mohamed told Reuters the group still held dozens of Platform prisoners but had released nine child soldiers.

A spokesman for Platform could not be reached for comment.