Ethiopia's Prime Minister Meles Zenawi says that his country is "technically" at war with Somalia's Islamic courts.
Since June Islamists have taken control of large parts of Somalia
"The jihadist elements within the Islamic Court movement are spoiling for a fight," he told Reuters news agency.
He said they were trying to avoid a "shooting war" but that if Ethiopia was forced to fight it would.
He said the few hundred armed Ethiopian military trainers in Somalia were there to support the beleaguered interim government based in Baidoa.
Somalia has been in the grip of warlords and militias for years and has not had a functioning national government since 1991.
The Union of Islamic Courts (UIC) has consolidated its control over much of southern Somalia after seizing the capital, Mogadishu, in June.
The UIC was set up by businessmen who wanted to impose law and order, and their gunmen have become Somalia's strongest fighting force.
The Islamists accuse Ethiopia of having troops inside the country as a fighting force backing the weak transitional government.
This is strongly denied by Addis Ababa, which says that the Islamists have soldiers within 15km of their common border.
"They've been declaring jihad against Ethiopia almost every other week. Technically we are at war," Mr Meles said.
"We believe they've been preparing terrorist outrages. They're very close to our border. The indications are not that encouraging. But we've been patient so far and we'll continue to be patient," he said.
"We are trying to avoid a shooting war to the maximum extent possible and therefore, as it were, we are looking the other way," the prime minister continued.
"They will have to force us to fight. That can come when and if they physically attack us."
The BBC's Amber Henshaw in the Ethiopian capital, Addis Ababa, says the situation is increasingly tense, with reports of weapons supplies being flown into Somalia on a regular basis.
Eritrea, which is deeply hostile to Ethiopia, is also alleged to have sent troops to Somalia to reinforce the UIC.
Observers fear that Somalia could become engulfed in a wider war for control of the Horn of Africa.