The Hungarian government posted ads in Lebanese newspapers on Monday warning migrants not to enter illegally, saying it is a crime punishable by imprisonment.

In a full-page advertisement in several newspapers, including Lebanon's leading An-Nahar daily, the government said "the strongest possible action is taken" against people who attempt to enter Hungary illegally.

"Do not listen to the people smugglers. Hungary will not allow illegal immigrants to cross its territory," the advertisement reads in English and Arabic.

Lebanon has nearly 1.2 million Syrian refugees, some of whom have expressed interest in migrating to Europe because of dwindling aid and work opportunities.

Hungary, which closed its border with Serbia on Sept. 15, erected another steel barrier at the Beremend border crossing from Croatia to try to slow the flow of migrants. But they kept coming.

People fleeing violence and poverty in the Middle East, Asia and Africa are crossing the Mediterranean Sea in rickety smuggler boats and rushing from one European border to the next to try to reach welcoming countries like Germany and Sweden.

Earlier this month, Denmark's Ministry of Immigration, Integration and Housing posted advertisements in Lebanese newspapers aiming to deter migrants, saying that the European nation has reduced social aid to migrants by 50 percent recently.

It also warned that migrants whose applications are rejected will be deported immediately.

Syria's civil war, now in its fifth year, has killed more than 250,000 people and generated more than 4 million refugees.