The Slovenian parliament late Monday authorised the army to help police manage the flow of migrants crossing the Croatian border into Europe's Schengen passport-free zone, which has been rocked by the refugee crisis.
The bill sailed through, approved by 69 votes against five in the 90-seat parliament.
Prime Minister Miro Cerar told journalists ahead of the vote that it was "a natural move under the circumstances" given the relentless influx, adding: "It doesn't (authorise the army to take) military action, but it is to provide assistance to the police in border-guarding tasks."
The bill authorises the army to manage the flow of migrants across the border for three months, including by temporarily detaining groups of migrants and handing them over to police.
The army is also authorised to use force in case of an emergency to "ensure citizens' safety," Cerar said.
Earlier this month Slovenia tightened control of the migrant flow to avoid becoming a bottleneck, as its northern neighbour Austria limited the daily number of people transiting.
Slovenia, which has a 670-kilometre (410 miles) Schengen external border with Croatia, became a key transit country for migrants travelling from Greece towards Austria and Germany in mid-October when Hungary sealed its borders.
Since then, more 470,000 migrants have entered Slovenia and, after undergoing identification, crossed the border into Austria.
Interior Minister Vesna Gyorkos Znidar told lawmakers the army's support was urgently needed to ease pressure on police manning the border and enable them to "perform their tasks inside the country, where we expect significant problems when migrants are denied entrance (into Austria)."