Macedonia has declared a state of emergency on its southern and northern borders over a surge in migrants and refugees, the Interior Ministry announced. The country said it would involve the army in confronting the crisis.

"We expect the involvement of the army will bring two desired effects – it will increase security among our citizens in the two regions and will allow for a more comprehensive approach toward people expressing their interest in applying for asylum," Interior Ministry spokesman Ivo Kotevski said.

He told Reuters that the “official border crossings are not shut,” but that authorities may have moved to seal off illegal routes used by the migrants and refugees.

Just in: Macedonia declares 'state of emergency' over migrants influx pic.twitter.com/lj1xltePHb — mcmounes (@mcmounes) August 20, 2015

Thousands of migrants were stranded on Thursday in a 'no-man's land' between Macedonia and Greece, near the Macedonian town of Gevgelija. From there, they planned to catch trains that would take them to the Serbian border, and onto Hungary, where they would benefit from Europe's borderless Schengen zone.

Riot police were sent to the town to try to restore order amid the chaos, and Reuters has reported that the flow of migrants in the town now appears to have suddenly stopped.

Macedonia has become a major transit route for migrants heading from Greece to more prosperous EU countries.

On Wednesday, Macedonia warned that it is running out of trains to transport the thousands of Syrian refugees heading toward the European Union, and called on its neighbors to help combat the “alarming situation.”

"The Macedonian Railway Company has no more capacity to carry all those who want to travel toward western European countries," the head of the state railway, Nikola Kostov, told Telma TV channel, urging neighboring countries and others to provide more train carriages.

The problem may worsen with the potential arrival of thousands who are being evacuated by boat from the Greek island of Kos to the mainland, after 21,000 people landed on Greek shores last week alone.

"Depending on how Greece uses ships to decongest the islands that will also temporarily increase the arrivals here," said Alexandra Krause, senior protection officer at the United Nations Commissioner for Refugees (UNHCR) in the Macedonian capital Skopje.

Almost 39,000 migrants, most of whom hail from Syria, have been registered passing through Macedonia over the past month. This figure is more than double that from the previous month.