Hungary says it will close down its border with Croatia at midnight Saturday morning, one month after sealing its Serbian border, to stop the free flow of migrants.

More than 383,000 migrants have entered Hungary this year, many escaping extreme poverty and terror groups including ISIS in the Middle East. Nearly all refugees have continued to Germany and other destinations further west in the European Union.

Foreign Minister Peter Szijjarto said Friday afternoon after a meeting of the national security Cabinet that "the Hungarian-Croatian green border will be closed from midnight."

"Croatia has a solution, Hungary can do whatever it wants."

- Croatia's Prime Minister Zoran Milanovic

Hungary clamped down on its border with Serbia with a similar barrier on Sept. 15. Since then, migrants have been taking a detour through Croatia to reach Hungary.

Croatia's prime minister said late Thursday that "Croatia has a solution, Hungary can do whatever it wants." He adds "we have a plan for Croatia to remain safe and without any problems for our citizens."

Zoran Milanovic has not said what Croatia would do, but says: "Croatia can always also build a fence, but we don't want that, it's the last option."

The Associated Press contributed to this report.