Updated

Soldiers arrested Burkina Faso's transitional president and prime minister Wednesday, raising fears of a coup just weeks before the country was to hold an election to replace its longtime leader who was ousted in a popular uprising late last year.

Hours later, gunfire erupted in the capital as the soldiers behind the standoff tried to disperse protesters who were marching on the presidential palace where the two transitional leaders were being detained. It was not immediately clear whether any of the demonstrators were wounded.

People could be seen fleeing in all directions as the shooting continued, according to an Associated Press reporter at the scene.

Members of the presidential security unit formed by the ex-president who was ousted from power last year have been publicly at odds with the transitional leaders in recent months. On Wednesday, they banned the interim president and prime minister from leaving, and were seen putting up barricades around the presidential palace.

Burkina Faso hosts French special forces and serves as an important ally of both France and the United States in the fight against Islamic militants in West Africa. While Burkina Faso has largely been spared from extremist violence, a Romanian national was abducted in April, and a Mali-based jihadi group claimed responsibility.

U.N. Secretary-General Ban Ki-moon was "outraged" by the reports of the detentions and called for the officials' immediate release, his spokesman said in a statement. "This incident is a flagrant violation of Burkina Faso's constitution and transitional charter," the statement said.

Moumina Cheriff Sy, the speaker of the transitional parliament, called Wednesday's developments "a blow to the republic and its institutions."

"I call on all patriots to gather to defend the motherland," he added, calling on members of parliament to protest.

There was no immediate claim by the military on public air waves that they now controlled the country.

News of the standoff Wednesday created panic in Burkina Faso's capital of Ouagadougou, where people closed shops early and headed home fearing violent demonstrations. The protests that led to President Blaise Compaore's ouster escalated to a point where the parliament building was set ablaze.

Interim President Michel Kafando and Prime Minister Lt. Col. Yacouba Isaac Zida had been tasked with organizing the Oct. 11 presidential election, which many hoped would strengthen the country's democracy after the 27-year rule of Compaore.

But there have been tensions over the vote because members of Compaore's party have been declared ineligible. Anyone who supported the ex-president's bid to amend the constitution so he could seek another term is also banned from running.

Another chief source of tension has been an ongoing dispute between the transitional officials and the country's elite Presidential Security Regiment, which was behind Wednesday's standoff. The 1,300-strong group was set up in 1996 by Compaore and had previously called for the resignation of the interim prime minister, who is a former second-in-command of the unit. The prime minister initially had threatened to disband the group back in December but later reversed course.

Then on Monday, a truth and reconciliation commission released a report again calling for the disbanding of the unit. Human rights groups have accused the regiment of opening fire on unarmed demonstrators last October, when massive protests forced Compaore to resign.

Burkina Faso's military initially had picked Zida to lead the country when it swooped in and took control in the power vacuum after Compaore's resignation. The international community, though, urged the military to swiftly hand back power or face crippling economic sanctions. Kafando, a former ambassador to the U.N., was then chosen as transitional president, and he tapped Zida to serve as prime minister.