Hungarian MPs have approved legislation allowing the government to send troops to help police manage the migration crisis.
The bill lets soldiers carry out many of the same tasks as police, such as checking ID, detaining suspects and controlling the flow of traffic at the borders.
While the soldiers will carry weapons, Hungarian officials vowed that the use of force would be only a last resort.
Defence Minister Istvan Simicsko said earlier that "you truly can't answer a slap with a rocket".
Before the vote, Prime Minister Viktor Orban said that allowing soldiers to help police would ensure Hungary can defend its borders with Serbia, Croatia and Slovenia, from where migrants have been entering on their way to Germany and other Western nations in the European Union.