Turkey's parliament has authorised the government to carry out cross-border military operations in Iraq and Syria to fight the Islamic State of Iraq and the Levant (ISIL) and other armed groups.

Thursday's vote also allows foreign soldiers to be stationed in Turkey and to use its military bases for the same purposes with no limit on the troop numbers.

The motion, put forward by the ruling Justice and Development (AK) Party, passed with 298 votes in favour and 98 against.

"The rising influence of radical groups in Syria threatens Turkey's national security. ... The aim of this mandate is to minimise as much as possible the impact of the clashes on our borders," Ismet Yilmaz, Turkish defence minister, told parliament.

Turkey shares a porous 900km border with Syria, and has seen the conflict frequently spill across its frontier and has responded in kind when mortars and shells fired from Syria have hit its soil, in some cases killing Turkish civilians.

Yilmaz said that Turkey could "not close its eyes" to the atrocities committed by ISIL, including beheadings and massacres.

"The only target of this text is a terrorist organisation that wants to disturb the peace" of Iraq and Syria, he said.

"The expansionist and pan-Islamist policy of Prime Minister [Ahmet] Davutoglu can only lead Turkey into war," Mehmet Akif Hamzacebi, a senior MP of the main opposition Republican People's Party (CHP), told the session.

The opposition Nationalist Movement Party (MHP) also voted in favour of the motion while the CHP and pro-Kurdish People's Democratic Party (HDP) voted against.

Turkey under pressure

Al Jazeera's Bernard Smith, reporting from Urfa in southern Turkey, said Thursday's vote allows Turkey to go after any terrorist threat, not just ISIL.

"The legislation spoke of the threat posed by the Assad regime, a destabilised Syria, the Kurds, and finally ISIL," he said.

The US welcomed the vote by Turkey's parliament.

"We have been closely engaged with Turkey. We welcome the Turkish parliament's vote to authorise Turkish military action," Jen Psaki, the State Department spokeswoman, said.

Turkey has come under pressure to play a more robust role in the US-led military campaign against ISIL after the group advanced to within clear sight of Turkish military positions on the Syrian border.

Turkey moved tanks and armoured vehicles near its southern border on Monday after shells and mortar bombs from Syria hit Turkish villages.

Turkey had previously refused to join a broad US-led coalition while dozens of its citizens were being held by ISIL after being abducted from the Turkish consulate in the northern Iraqi city of Mosul.

The hostages were released earlier this month.