The UN Security Council has authorised an African-led military force to try to oust Islamists from northern Mali.
The council unanimously voted to give the force an initial one-year mandate.
The resolution also sets "benchmarks" for Mali, including political reconciliation and improved training for the military.
Armed groups, some linked to al-Qaeda, took control of northern Mali after a military coup in March and established a harsh form of Islamic law.
The Economic Community of West African States (Ecowas) says it has 3,300 troops ready to go to Mali - although an operation is not expected to begin before September 2013.
The resolution, drafted by France, sets out a multi-stage process for reunifying Mali.
EU and other UN member states are tasked with helping to rebuild Mali's army, which collapsed when Tuareg nationalists and Islamist rebels overran the north.
The BBC's Barbara Plett at the UN says the idea is to get the army into shape for a joint military operation with the Ecowas force.
The UN also wants political progress to be made before the military operation, including holding elections by April "or as soon as technically possible."
The resolution emphasises that further military planning is needed and asks Secretary-General Ban Ki-moon to "confirm in advance the council's satisfaction with the planned military offensive operation".
It said the military force - which would be known as the African-led International Support Mission in Mali (Afisma) - should use "all necessary measures" to help recover the north of the country from "terrorist, extremist and armed groups".
Mali's Foreign Minister Tieman Coulibaly welcomed the resolution as "an historic step".
France's UN ambassador Gerard Araud said: "Nobody is ignoring the complexity of the task that awaits the international community to restore the territorial integrity of Mali and to end the terrorist activities in the north of the country."
After the Islamists and Tuaregs seized northern Mali, their alliance quickly collapsed, with the Islamists taking the region's main urban centres.
The Islamists have since destroyed ancient shrines in Timbuktu and imposed a brutal version of Islamic law, sparking international outrage.
Thousands of people fled the north after the fighting, many of them ending up in neighbouring Mauritania.
A recent leaked UN report warned that about 400,000 more people could be made homeless if the military operation to oust the militants goes ahead.