Kenya must take care not to let its cross-border incursion into Somalia to secure its border from al Qaeda-linked militants turn into a drawn-out campaign, former United Nations secretary-general Kofi Annan said on Thursday.

Nairobi have launched an attack into Somalia to flush out Islamist al Shabaab rebels from its porous frontier area after a series of kidnappings of foreigners in Kenya.

Although Kenyan troops have made brief incursions into Somalia, this week's operation is on a much larger scale and increases the risk of dragging Nairobi deeper into Somalia's two-decade-old civil war, as well as reprisal attacks.

Speaking in Nairobi, Annan said the military campaign, which Kenya launched with support from Somali government forces on Sunday, would be difficult.

From an operational point of view and a military point of view, given my own peacekeeping experience, it is not going to be an easy operation, Annan told Reuters in an interview.

I suspect the message they're (Kenya) trying to send out is 'we will not stand by, we will defend our territory, stop the incursions, stop coming in to kidnap people, stop coming in to commit crime', Annan said.

But one has to be careful that this engagement doesn't lead to a long, drawn-out entanglement and I hope the government, and I suspect the government, is aware of that.

On Thursday Kenyan and Somali troops advanced on an Islamist-held town in southern Somalia. A senior Somali commander has said the operation's aim was to rid Kismayu, a port city that serves as the rebels' nerve centre for operations, of the militants.

I think if they are defending their borders, it's one thing. If they decide to go into Kismayu, it's another thing altogether, Annan said.

The former secretary-general said the international community has to engage more to stabilise Somalia, which has been affected by a cycle of violence since the 1991 ousting of military dictator Mohamed Siad Barre.

He also called for the strengthening of the African Union peacekeeping force fighting al Shabaab alongside government troops in the Somalian capital, Mogadishu.

Besides al Shabaab's insurgency since 2007, pirates have also been operating off the Horn of Africa nation's coast, seizing vessels and demanding huge ransoms in return.

What is important is the broader international community works with the region to take steps not only to contain the crisis but to begin to tackle it at the root causes, Annan said.

We abandoned Somalia in the early 90s and we are paying the price now.