Central African Republic's interim President Michel Djotodia has resigned at a regional summit aimed at ending violence that has engulfed the country.
PM Nicolas Tiengaye also resigned at the meeting in Chad.
Mr Djotodia, CAR's first Muslim leader, seized power last year. Since then 20% of the population have fled fighting between Christian and Muslim militias.
Emergency evacuations are due to begin on Saturday of the first of thousands of foreigners stranded in CAR.
The International Organization for Migration said it would start airlifting around 800 Chadians from the capital Bangui on Saturday.
Some 33,000 Africans from neighbouring countries were in "urgent need of help", it warned.
The UN has warned of an impending humanitarian disaster in the country.
Since December and the arrival of more regional peacekeepers and French troops, 1,000 people have died in sectarian clashes.
Many villages are deserted and in the past month the number of those who have fled their homes has doubled - including almost half of those living in the capital.
Following the announcement from Chad, thousands of people took to the streets in Bangui, most of them celebrating the news.
Carine Gbegbe, who has been living in a displacement camp, told the Associated Press news agency: "Finally we are free. We are going to return home at last."
Those celebrating Mr Djotodia's removal were largely Christians, the BBC's Paul Wood reports from Bangui, while Muslims largely stayed at home.
The main demand of Mr Djotodia's opponents had been for him to step down, and many Christians now want to go back to the way things were with their Muslim neighbours, our correspondent says.
However, there were exchanges of gunfire on Friday between rival militias and it is too early to say the violence is at an end, he adds.
French tanks were quickly deployed around the presidential palace.
French Defence Minister Jean-Yves Le Drian called for a replacement for Mr Djotodia "as soon as possible".
Mr Djotodia's resignation was made in a statement by the 10-nation Economic Community of Central African States (Eccas).
The whole of CAR's National Transitional Council (CNT) had been flown in at short notice to decide the leadership of their nation.
The lawmakers met regional leaders while Mr Djotodia held separate talks with allies from his former Seleka rebel alliance, AFP reported.
Under a deal brokered by regional powers last year, the CNT was charged with choosing a transitional leader to take CAR to elections due at the end of 2014. It formally elected Mr Djotodia to his position as interim president last April.
Seleka seized power last March overthrowing the then-President Francois Bozize, from CAR's majority Christian population.
Although Mr Djotodia officially disbanded the Seleka rebels, he has proved unable to keep them in check.
Their actions have prompted Christians to form vigilante groups, sparking a deadly cycle of revenge attacks.
The African Union now has some 4,000 peacekeepers in the country and France has deployed 1,600 troops to try to restore peace.