Burkina Faso's President Blaise Compaore has announced hisresignation, following violent protests at his attempt to extend his 27-year rule.
Mr Compaore issued a statement saying the presidency was now vacant and urging elections within 90 days.
Military chief Gen Honore Traore said he had taken over as head of state "in line with constitutional measures".
Crowds danced and cheered in the capital, Ouagadougou, after Mr Compaore's resignation was broadcast.
On Thursday, protesters angry at his attempt to amend the constitution had set fire to parliament and government buildings.
'Social peace' Mr Compaore had earlier vowed to remain in power until a transitional government completed its work in 2015, although he had agreed not to seek another term.
However, the opposition continued to demand that he resign - a key leader, Zephirin Diabre, urged protesters to occupy public spaces.
After the resignation, Mr Diabre told the BBC's Focus on Africa radio programme: "We are all relieved by what is happening - and this is our demand for so long so we are very happy - and we need to work on the transition to take care of our country."
But the BBC's Yacouba Ouedraogo, in Ouagadougou, says that many demonstrators see Gen Traore as too close to the ousted president - he was Blaise Compaore's aide de camp - and not enough of a rupture with the past.
Mr Compaore's statement, read on television, said: "In order to preserve the democratic gains, as well as social peace, I declare a power vacuum to allow the establishment of a transition leading to free and fair elections within a maximum of 90 days."
He added: "For my part, I think I have fulfilled my duty."
His whereabouts now remain unclear.
However, Reuters news agency reported that a heavily armed convoy believed to be carrying Mr Compaore was travelling towards the southern town of Po.
One protester, Sam, told the BBC: "Blaise Compaore has gone away, he's running away and we are happy. The words are not coming so easy because I'm very happy, my children are going to know another president."
France welcomed the resignation, saying it "allows a solution to be found to the crisis".
In a statement, Gen Traore said: "In line with constitutional measures, and given the power vacuum... I will assume as of today my responsibilities as head of state."
He added: "I undertake a solemn engagement to proceed without delay with consultations with all parties in the country so as to start the process of returning to the constitutional order as soon as possible."
Late on Thursday, he had announced the creation of the transitional government, declared the dissolution of parliament and imposed a night curfew.
Blaise Compaore was a young army officer when he seized power in 1987, a taciturn man who became known as Beau Blaise - good looking Blaise. The nickname did not necessarily suggest he was popular. Many blamed him for the death of his predecessor, the charismatic revolutionary Thomas Sankara, who was killed by soldiers in mysterious circumstances.
Controversy would be a perpetual feature of Beau Blaise's time in power. The president was accused of stoking rebellions around West Africa. Yet over time Mr Compaore oversaw a transformation of his image, internationally at least. This inflammatory figure became a man relied upon to put out fires around the region.
Mr Compaore won a series of elections, though the opposition always complained the odds were stacked dramatically in his favour. He largely followed the economic orthodoxy prescribed by international financial institutions. But Burkina Faso did not escape the poverty trap. It remains one of the least developed countries in the world.