Mali's government has signed a peace deal with Tuareg rebels to help pave the way for elections next month.
The accord calls for an immediate ceasefire and for government troops to return to the rebel-held northern town of Kidal, officials said.
The rebels captured Kidal after a French-led offensive forced militant Islamists out of the town in February.
The Tuaregs have been fighting for autonomy in the north since Mali gained independence from France in 1960.
They say they are marginalised by the government in the capital, Bamako.
French President Francois Hollande, announcing the deal after the G8 summit in Northern Ireland, said the agreement paved the way for a presidential election across Mali, including in Kidal.
The main rebel group which signed the accord, National Movement for the Liberation of Azawad (MNLA), had formed an alliance with al-Qaeda-linked militants to seize the north in 2012.
But the alliance quickly crumbled, and the Islamists took control of the MNLA's strongholds.
Government and MNLA negotiators reached the deal after nearly two weeks of talks brokered by Burkina Faso's President Blaise Compaore in the Burkina capital, Ouagadougou.
The army had threatened to seize Kidal if no agreement was reached.
Malian government representative Tiebile Drame said the two sides had overcome their greatest differences.
"I think we can say that the biggest task is finished. We have agreed on the essentials," AP news agency quoted him as saying.
"There is an international consensus as well as a Malian consensus on the fundamental questions, which include the integrity of our territory, national unity, and the secular and republican nature of our state.''
MNLA spokesman Moussa Ag Attaher confirmed a deal had been reached.
"The MNLA and the High Council for the Azawad [the rebel name for northern Mali] have given everything for peace and so we accept this accord,'' AP quoted him as saying.
The MNLA has watered down its demand for independence, saying it will settle, as a first step, for autonomy for the desert region where they live.
The UN is due to deploy a 12,600-strong peacekeeping force before planned elections on 28 July, which will incorporate thousands of West African troops already in the country in support of the French intervention.
The elections will be the first in Mali since the military staged a coup in 2012, accusing the government of failing to end the conflict in the north.
However, the Islamists and Tuareg rebels took advantage of the ensuing chaos in Bamako to capture more territory.
France intervened in January after the Islamists advanced southwards, raising fears that they intended to seize the capital.
It plans to gradually hand over to the Malian army and a UN peacekeeping force before presidential and parliamentary elections are held.