The US has launched air strikes against Islamists in southern Somalia, confirming the country's status as a new frontline in Washington's war on terror.

An AC130 warplane strafed the village of Hayo near the Kenyan border late yesterday afternoon, leaving "many dead", according to the Somali government. Ras Kamboni, on the country's southernmost tip, was also said to have been hit.

Another air strike killed up to 31 people this morning near the town of Afmadow, 220 miles southwest of the capital, Mogadishu, according to local witnesses and officials.

The US attack helicopters were trying to kill Islamist militants, a Somali defence ministry official said.

The Associated Press cited witnesses as saying 31 civilians, including two newlyweds, had been killed in the strike, by two US helicopter gunships. Reuters cited a local witness as saying between 22 and 27 people had been killed.

According to Pentagon officials, yesterday's US targets included several alleged al-Qaida members suspected of organising the attacks on US embassies in Kenya and Tanzania in 1998.

It is not known whether Abu Taha al-Sudan - a Sudanese explosives expert who is thought to head al-Qaida operations in east Africa, and to have been the primary target - was among the dead, or whether there were significant civilian casualties.

The Somali government, whose legitimacy was challenged by the rise of the Islamic courts movement in June last year, said it supported the strikes.

The US had "a right to bombard terrorist suspects who attacked its embassies in Kenya and Tanzania," the Somali president, Abdullahi Yusuf, told journalists in Mogadishu.

Though the US has been mounting covert operations in Somalia in recent years, the attacks amount to its first direct involvement since the disastrous "Black Hawk Down" operation during the early 1990s.

After the strikes, the US navy confirmed it had moved the aircraft carrier USS Eisenhower to join three other warships patrolling the Somali coast to prevent Islamist fighters from escaping by sea. US planes were conducting "intelligence-gathering missions" over Somalia, a navy spokesman said.

The Islamists of the Somali Council of Islamic Courts (SCIC), who took control of most of south and central Somalia during the latter half of 2006, bringing in law and order for the first time in 15 years, were routed from their urban strongholds, including Mogadishu, by Ethiopian troops at the end of December. Many fighters fled into the bush in the far south of the country.

The US tracked the Islamists' retreat from its Combined Task Force headquarters in Djibouti, which was established as a counter-terrorism base after the September 11 2001 attacks. Like Ethiopia, Washington accuses the Islamist leaders of both harbouring and being influenced by al-Qaida members - a view many analysts believed is exaggerated.

Besides Abu Taha al-Sudan, the US believes that Fazul Abdullah Mohammed, a Comorian, and Saleh Ali Saleh Nabhan, a Kenyan - both of whom are both accused of terror attacks in Kenya - have been hiding in Somalia.

Initially the US tried to capture the men with the help of warlords who ruled Mogadishu from 1991 until the SCIC took control last year.

In 2005, secret service agents paid the hated warlords several hundred thousand dollars as an incentive to apprehend the suspects who, according to Washington, were being sheltered by the Islamic courts that had been set up to dispense justice in the absence of a central authority.

But as news of the US operation leaked to the streets, residents took the side of the Islamists, and helped drive the warlords from the capital.

When Ethiopia sent thousands of troops in to back Somalia's weak government against the Islamists at the end of last year, the US gave its tacit approval, but remained in the background. Matt Bryden, a consultant to the International Crisis Group, based in Nairobi, said the US might now have decided to act directly because the Ethiopians were having trouble picking off the "last bubbles of Islamist resistance" near the Kenyan border, which is closed.

"They [the Americans] must have believed they knew where the al-Qaida suspects were. It seems they decided to kill everything within a certain grid square and then find out what they had hit," he said

He said reaction to the strikes within Somalia - a moderate Muslim country where many people resent outside interference - would depend on who had been killed.

"If no foreigners died, this will just be the latest element in a comedy of errors by the US and a step towards the new Iraq of Africa," said Mr Bryden. "But if there is proof of foreign al-Qaida members being killed, the US can say 'We told you so' and Somalis may be OK with it."

The AC130 plane that carried out the strikes, is understood to have flown from Djibouti, where 1,500 soldiers are based. Unlike the unmanned Predator drone that killed an al-Qaida operative in Yemen - across the Gulf of Aden from Somalia - in 2002, the gunship is not designed for surgical strikes. First used in Vietnam, where it was nicknamed Puff the Magic Dragon, the converted cargo plane uses sensors to guide its heavy cannons.

Richard Cornwell, a senior research fellow at the Institute for Security Studies in Pretoria, said the strikes showed that cooperation between Ethiopia and the US over the Somalia incursion had been far closer than suspected, and was critical of the manner of the attack.

"The AC130 is an appallingly blunt instrument and I very much doubt it can be used to target individuals," he said. "To kill alleged terrorists regardless of collateral damage is highly hypocritical."