"To resist this clear and present danger, the policy of this government is first to try to solve the problem through negotiation and dialogue," Meles said. "So far, our attempts have not been successful."
"When any country faces that type of danger it has the full right to defend itself against this threat. To exercise this right we have been preparing for this kind of response, because it is our responsibility."
He gave no details on what the plans might be, but Ethiopia has been accused of sending troops into Somalia and massing more on the border.
"We are not a threat to Ethiopia, but the presence of its troops in our homeland is a serious security risk to Somalia as well as Ethiopia."
Abdurahim Ali Muddey, Islamic courts spokesman
Send your views
The Islamic courts has said it will fight Ethiopian soldiers in Somalia. Addis Ababa says that only military advisers are working in the country.
In Mogadishu, Islamic courts officials met to discuss their response to the comments.
"If Ethiopia is ready for war, we are very ready for the defence of our country," Abdurahim Ali Muddey, Islamic courts spokesman, said.
"We are not a threat to Ethiopia, but the presence of its troops in our homeland is a serious security risk to Somalia as well as Ethiopia," he told AFP news agency.
The Islamic courts has said that its fighters carried out attacks on Ethiopian military targets around Baidoa, the seat of the largely powerless interim government, on Sunday and Wednesday.
Muddey also said that the United States had been invited to send a delegation to Mogadishu "to see what is happening in Somalia" and hear their objections allowing peacekeepers into the country.
Ethiopian opposition politicians refused to accept a motion endorsing the prime minister's statements, saying it was tantamount to a declaration of war.
"This motion needs to be amended and negotiated with the parties' representatives in the parliament," Beyene Petros, an opposition MP, told AFP news agency.
Peace talks aimed at averting a war collapsed earlier this month with the Islamists demanding the withdrawal of Ethiopian troops as a pre-condition to meeting delegates from the interim government.