* In statement, Compaore calls for election in 90 days
* Protesters frustrated after military chief claims power
* General vows "process of return to constitutional order"
* Lieutenant Colonel appears to challenge military chief (Adds analyst comment, details, quotes)
By Mathieu Bonkoungou and Joe Penney
OUAGADOUGOU, Oct 31 (Reuters) - Burkina Faso President Blaise Compaore resigned on Friday amid mass street protests at his attempts to extend his 27-year rule, plunging the West African nation into uncertainty as junior officers vied with top military brass for power.
Compaore, a taciturn former soldier in office since a 1987 military coup, had sought to defy popular pressure for him to step down after a day of violent unrest on Thursday in which demonstrators burned parliament and ransacked state television.
Impoverished Burkina Faso had emerged under Compaore as a key mediator in the turbulent Sahel and his departure robs the region of a wily elder statesman -- though one often criticised for his rights record and meddling in his neighbours' affairs.
The landlocked nation has become a key ally in Western operations against al Qaeda-linked groups in West Africa and the unfolding political crisis was being closely watched by the United States and France, which has a special forces base there.
Diplomats voiced concern after military chief General Honore Traore's announcement he was taking charge as head of state appeared to be challenged by presidential guard commander Lieutenant Colonel Issaac Zida, who announced his own set of emergency measures and deployed troops on the streets.
The demonstrations had erupted on Thursday when parliament had been due to vote on plans to change the constitution to allow 63-year-old Compaore to seek reelection next year. At least three people were shot dead and dozens wounded.
With hundreds of thousands packing the Place de la Nation in the capital Ouagadougou for a second day on Friday, and with no sign of international support -- particularly from former colonial power France -- Compaore bowed to public pressure.
"I believe that I have fulfilled my duty, my only concern being the higher interest of the nation," said a written statement from Compaore read on national television, in which he called for elections within 90 days.
A heavily-armed convoy believed to be carrying the former president was seen travelling towards the southern town of Po near the border with Ghana, which is home to a large military base, diplomatic sources and local media said.
The departure of Compaore -- until recently seen as one of West Africa's most invulnerable Big Men -- will send ripples across a region where a number of long-standing rulers are nearing the end of their terms amid rumbling discontent.
Crowds danced, cheered and blew whistles in Ouagadougou's dusty streets after Compaore's statement was broadcast.
"This is a sub-Saharan Spring and it must continue against all the presidents who are trying to hang on to power in Africa," said law student Lucien Trinnou, referring to the Arab Spring that toppled several long-term leaders.
Jubilation turned to frustration, however, after General Traore -- a former military aide de campe of Compaore -- announced he was taking over the reins of power.
Under Burkina Faso's constitution, the head of the National Assembly should take office if the president resigns but parliament was dissolved by Traore on Thursday under short-lived martial law, leaving a power vacuum into which he stepped.
It was the seventh time that a military officer had taken power since the country declared independence from France in 1960, when it was known as Upper Volta.
"Considering the urgency of saving the nation, I have decided to assume from today the responsibilities of head of state," said the bespectacled Traore, wearing military fatigues and flanked by other officers.
"I make a solemn pledge to proceed without delay to consultations with all parties to start the process of returning to the constitutional order as soon as possible."
There was no immediate reaction from the leaders of the fragmented opposition but on the streets of Ouagadougou many protesters rejected a man regarded as a figurehead of Compaore's regime. Traore was named military chief in the wake of a failed 2011 uprising in which soldiers took part, with a mission to shake up the armed forces.
Capitalising on the frustration among protesters, a group of junior officers led by Lieutenant Colonel Zida -- who commands the army's best trained and equipped force - quickly moved to challenge Traore's authority, announcing curfew measures and the closure of borders.
"Power belongs the valiant people of Burkina Faso. No one can take this victory away from you. All the important decisions will be taken here in the Place de la Revolution," Zida told a crowd of tens of thousands of people, using the old name for the Place de la Nation that was changed by Compaore.
"The army had to respond to the call of the people. It is not seizing power like in a coup d'etat."
Before he spoke, trucks of soldiers left the military camp beside the square. A member of Zida's entourage said they were taking up positions around the capital and the army's top brass had been instructed not to make further public statements.
It was not immediately clear how France, which has more than 3,000 troops in the region, would react to any power struggle. French President Francois Hollande, who had discreetly sought ways to usher Compaore into an international role when his term ended next year, earlier welcomed his resignation and called for quick elections.
A delegation from the African Union, the United Nations and regional West African bloc ECOWAS was due in Burkina Faso on Friday to hold talks with all sides, but with the airport closed it was not clear if they arrived. ECOWAS said on Thursday it would not accept any seizure of power by unconstitutional means.
Diplomats said Compaore's reluctance to leave power was linked to a fear of prosecution on rights charges, following cases against African leaders in recent years such as former Liberian president Charles Taylor.
Compaore is often blamed for the death of former president Thomas Sankara -- his friend and former patron -- in his 1987 putsch. Sankara was a popular left-wing revolutionary, dubbed "Africa's Che Guevara", who changed the name of the country to Burkina Faso -- meaning 'Land of the Upright Men'. (Additional reporting by Daniel Flynn, Emma Farge, David Lewis and Bate Felix in Dakar, John Irish in Paris, Matt Bigg in Accra and Joe Bavier in Abidjan; Writing by Daniel Flynn; Editing by Dominic Evans)