* Tens of thousands mass outside presidential palace
* Military to issue statement, opposition hold talks
* Protests over plan to extend president's rule
* Emergency services say at least three protesters shot dead (Recasts with state of emergency)
By Mathieu Bonkoungou and Joe Penney
OUAGADOUGOU, Oct 30 (Reuters) - Burkina Faso's military dissolved parliament and announced a transitional government on Thursday after violent protests against President Blaise Compaore, but it was not immediately clear who was in charge.
Army chief General Honore Traore said the new government would be installed after consultation with all political parties and would lead the country to an election within 12 months. He also announced a curfew from 1900 to 0600 GMT.
The move came after tens of thousands of angry protesters packed the streets of Ouagadougou on Thursday to demand Compaore's departure, storming parliament and setting it on fire and ransacking state television.
At least three protesters were shot dead and scores wounded when security forces opened fire on the crowd.
"Given the need preserve the country from chaos and preserve national unity ... the National Assembly is dissolved, the government is dissolved," Traore told a news conference.
However, he declined to say whether Compaore, whose attempt to extend his 27-year rule has sparked months of tension in the landlocked country, remained the head of state.
Regional West African bloc ECOWAS had said earlier on Thursday that it would not accept any party seizing power through non-constitutional means - suggesting diplomatic pressure to leave Compaore in place.
Before the military's announcement, the president had issued his own statement announcing a state of emergency to be enforced by the army and calling for talks with the opposition.
The protests were sparked by the government's attempt to push a constitutional change through parliament to allow the 63-year-old president to seek reelection next year. Large protests also erupted in Bobo Dioulasso, Burkina's second biggest town, and Ouahigouya, in the north.
In the capital, the crowd faced off with security forces outside the presidential palace in a tense standoff that lasted several hours as opposition leaders held talks with senior military officials in an attempt to ease Compaore from power.
Both opposition leaders and protesters on the streets have made it plain they would not allow any role for Compaore. Hundreds of angry protesters gathered outside the headquarters of the armed forces following the president's statement, many of them shouting "Blaise Leave" and "No More Blaise".
"We want Blaise Compaore to leave. We want change," said George Sawadogo, a 23-year-old student.
The departure of Compaore, a close military ally of the United States and former colonial power France, would be closely watched by other governments across West and Central Africa, where a number of long-serving leaders are reaching the end of their constitutional terms.
Burkina Faso is one of the world's poorest nations but has positioned itself as a mediator in regional crises. It is also a key ally in Western operations against al Qaeda-linked groups in West Africa.
Amid uncertainty over how the army's announcement would be received abroad, Ghana's Foreign Minister Hanna Tetteh said in a tweet the country's embassy in Burkina confirmed a military takeover of power. She declined to provide further details.
White House spokeswoman Bernadette Meehan had earlier said in a statement that the United States was deeply concerned by the deteriorating situation in Burkina Faso and called on all parties to end the violence and respect democratic norms.
France, which has a special forces base there that conducts operations across the Sahel, also appealed for restraint by all sides. Its embassy had held talks with opposition leaders on Thursday.
Compaore has ruled the nation with a firm grip but has faced increasing criticism in recent years, including defections by members of his party. He weathered a military and popular uprising in 2011 thanks to the support of his elite presidential guard.
Diplomatic pressure had mounted over the past year for Compaore to step down in 2015, amid calls from his own entourage for him to seek re-election, diplomats said.
A letter from French President Francois Hollande to Compaore earlier this month, seen by Reuters, offered France's support in finding him a job with an international organisation.
Diplomats, however, say Compaore has been concerned at the possibility of losing his immunity from prosecution, particularly in the wake of the trial of former Liberian leader Charles Taylor in the Hague.
Burkina Faso's former president Thomas Sankara, a leftist leader dubbed Africa's Che Guevara, was killed in the coup that swept Compaore to power. Protesters in the streets of Ouagadougou waved photographs of Sankara and signs reading "Sankara look at your sons. We are fighting your fight."
At the headquarters of state television, which was forced off the air after the building was taken, jubilant protesters posed on the set of the evening news programme.
Burkina Faso, the fourth largest gold producer in Africa, has attracted several goldminers including TrueGold, IamGold and Randgold Resources. (Additional reporting by Daniel Flynn, David Lewis and Bate Felix in Dakar, Joe Bavier and Ange Aboa in Abidjan, John Irish in Paris; Writing by Daniel Flynn; Editing by Tom Heneghan)