although several humanitarian organisations said they might amount to a violation of human rights.
"Slovenia cannot wait until public order and internal security are in danger," Interior Minister Vesna Gyorkos Znidar told parliament before the vote.
"If the European Union will not find a sustainable and effective solution (to the migration problem), Slovenia has a legitimate right and obligation to use decrees that are necessary to protect its interests," she added.
The Amnesty International said earlier on Thursday the new law "is a serious backward step for human rights in Slovenia".
The Council of Europe, the continent's leading human rights organisation, called upon parliament last week to reject the amendments, saying states should ensure that migrants arriving at their borders have access to a procedure enabling them to put forward reasons not to be refused entry.
But Slovenia claims it has to prevent a repeat of a six-month-influx of migrants that ended in March 2016, when several countries to its south closed the main Balkan migrant route.
In that period Slovenia, the smallest state along the migration corridor, saw almost 500,000 illegal migrants crossing the country on their way to wealthier west European countries.
Centre-left Prime Minister Miro Cerar had said Slovenia would not be able to endure another large influx of migrants, particularly since its northern neighbour Austria and other west European states were closing their doors to migrants.
Reuters