Soldiers in Guinea-Bissau have detained former prime minister and presidential election front-runner Carlos Gomes Junior in West Africa's second military power grab in a month, political and diplomatic sources said.

Carlos Gomes Junior and the whole government are under arrest, presidential candidate Ibrahima Alpha Diallo told Reuters on Friday, saying people confirmed this to him. Diplomatic sources said they were told Gomes Junior was in a secure place.

Diallo was one of the contenders eliminated in last month's presidential election first round in which Gomes Junior had finished on top, qualifying for a run-off later this month.

The detentions by members of the military followed an attack on Gomes Junior's residence in the crumbling coastal capital Bissau on Thursday evening in which soldiers blasted the house with machine guns and heavy weapons.

Diplomats said the putsch in the coup-prone West African state, initially claimed by a shadowy self-styled Military Command, appeared to be an attempt to prevent an election win by Gomes Junior, the candidate of the ruling PAIGC party.

He was unpopular with elements of the military because he supported an initiative to reform and downsize the bloated army, which has a history of bloody revolts and meddling in politics since Guinea-Bissau's independence from Portugal in 1974.

Foreign governments from the United States to Portugal quickly condemned the latest military interruption of civilian rule in West Africa. Portuguese Foreign Minister Paulo Portas called for the release of the detainees.

The Community of Portuguese-Speaking Countries (CPLP), which counts Guinea-Bissau among its members, called an extraordinary meeting in Lisbon for Saturday to discuss the events in Bissau.

West African states are also struggling to deal with a crisis in Mali, where a coup last month triggered the occupation of the north of the country by Tuareg and Islamist rebels. Facing international pressure, the Mali coup leaders have handed power back to a civilian interim president.

Bissau was calm but expectant on Friday. Armed soldiers guarded the offices of the presidency, government buildings, the state broadcaster and main roads in and out of the city.

It was not clear who was leading the military operation.

A communique from a self-styled Military Command read on the Portuguese RDP Africa radio said it had acted to head off what it alleged was a secret pact between Gomes Junior and Angola to annihilate the Guinea-Bissau armed forces.

The unsigned communique said the Military Command did not have ambitions of power, but did not elaborate further.

Angola, which due to its oil wealth is much richer than Guinea-Bissau, had been providing military trainers and advisers to the smaller state in a military cooperation mission. But it announced a few days ago that it was ending the mission.

Diplomats believed, however, the real target of the coup was Gomes Junior, who won close to an outright majority in last month's first round of voting in a presidential election. He was widely expected to be elected in a run-off set for April 29.

It's very well known that the army didn't like Carlos Gomes Junior and he was about to be elected. So they either had to kill him or make sure he wasn't elected, one Bissau-based diplomat, who asked not to be named, told Reuters.

AFTER MALI, ANOTHER REGIONAL HEADACHE

The United States called for the restoration of civilian rule. It is regrettable that elements of the Bissau-Guinean military have chosen to derail the democratic process in Guinea-Bissau, the U.S. embassy in the country said in a statement.

In Bissau, a political source who asked not to be named said soldiers also arrested the country's interim president, Raimundo Pereira, an ex-parliament speaker who is also a PAIGC member.

There were reports of soldiers ransacking the homes of ministers and senior officials, many of whom were in hiding.

News of the Guinea-Bissau events shocked and dismayed foreign ministers of the West African regional grouping ECOWAS who had been meeting in Abidjan, Ivory Coast on Thursday to discuss Mali. Guinea-Bissau Foreign Minister Mamadu Djalo Pires, who was also in Abidjan, called for an energetic reaction from the international community against what he said was a coup.

Guinea-Bissau, whose weak governance has made it a haven for Latin American drug cartels transshipping cocaine to Europe, was in the middle of electing a president to replace Malam Bacai Sanha, who died in a Paris hospital in January after an illness.

Gomes Junior's rival in the run-off, Kumba Yala, had said he would boycott the vote over alleged first-round rigging. Only hours before the attack, Yala, a former president who claims ethnic ties with the mostly Balanta military, had warned of consequences if campaigning for the second round went ahead.

Guinea-Bissau is one of the world's most fragile and volatile states. Its main official export is cashew nuts. An ordinary Bissau Guinean lives on less than $2 a day.

Political assassinations, health problems and meddling by an oversized military have prevented any president from serving a full term since multi-party politics began in 1994.

Top military officials in Bissau have been accused by the United States of being drug runners.

(Additional reporting by Mamadu Cande in Bissau, Andrei Khalip in Lisbon, David Lewis in Bamako and Joe Bavier in Abidjan; Writing by Pascal Fletcher; Editing by Mark Heinrich)