Armed men from Syria have carried out an ambush in western Iraq killing 48 unarmed Syrian soldiers and nine Iraqi guards, the Iraqi defence ministry said.

The soldiers crossed into Iraq from the Yaarabiya border crossing, the scene of heavy fighting on Saturday between rebels and troops loyal to President Bashar al-Assad, said Lieutenant Colonel Mohammed Khalaf al-Dulaimi of the border protection forces on Monday.

Ali Mussawi, Prime Minister Nuri al-Maliki's spokesman, said the ambush "confirms our fears of the attempt of some to move the conflict to Iraq, but we will face these attempts by all sides with all of our power".

The defence ministry said in an online statement that the ambush was carried out "by a terrorist group that infiltrated into Iraqi territory coming from Syria," and put the death toll at 48 Syrian soldiers and nine Iraqi guards.

It said a number of unarmed Syrian soldiers wounded in fighting had fled to Iraq for medical treatment and were being transferred to Al-Walid border crossing to be returned to Syria through "official channels".

But they were ambushed on the way, in what the ministry termed "an attack against the sovereignty of Iraq, its land, and its dignity, and a clear violation of human rights, as [the soldiers] were wounded and unarmed".

The ministry also issued a warning to all sides in the conflict in Syria, where Assad is locked in a bloody, prolonged civil war with rebels, "against moving their armed conflict to Iraqi territory and violating Iraq's borders".

The past week has seen clashes between the Syrian army and rebels at the borders, which have brought the conflict close to Iraq.

Opposition fighters seized control of half of the northeastern Syrian border town of Yaarabiya, including a shared crossing with Iraq, in a battle with forces loyal to Assad on Saturday.

Earlier on Friday, A Scud missile fired from Syrian territory landed near a village opposite Yaarabiya, causing no damage but terrifying locals, according to the mayor of Telefar.

The conflict in Syria has previously spilled into Iraq. In September, a five-year-old girl was killed when three rockets struck a border town in the al Qaim area.

Iraq's precarious sectarian and ethnic balance has also come under strain from the conflict next door, where mainly Sunni Muslim insurgents are fighting to overthrow Assad, who is backed by Shia Iran.

Earlier this week, Iraqi Prime Minister Nuri al-Maliki, a Shia Muslim, warned that a victory for rebels in the Syrian civil war will spark a sectarian war in his own country, a civil war in Lebanon and a division in Jordan.