Hungary's foreign minister says a fence on the Serbian border to stem the flow of migrants and refugees will be built within a few months, beginning with the areas most used by human smugglers.

Foreign Minister Peter Szijjarto says the 4-meter (13-foot) high fence will "defend Hungary and the European Union from the startling scale of illegal immigration pressure."

Meanwhile, the U.N. refugee agency urged Hungary to refrain from implementing a plan which could make its asylum system more restrictive for refugees.

Montserrat Feixas Vihe, the UNHCR's regional representative for Central Europe, says the new rules "would have devastating implications for thousands of people seeking safety in Hungary."

Szijjarto said Thursday on state television that police had detained more than 68,000 illegal immigrants this year, nearly all arriving from Serbia.