The European Union should put a priority on stopping illegal migration instead of trying to persuade the 27 member nations to share responsibility for people who arrive without authorization, the prime ministers of Italy and Poland said Wednesday.

Italy's right-wing leader, Premier Georgia Meloni, traveled to Warsaw for a meeting with her conservative Polish counterpart, Prime Minister Mateusz Morawiecki. As a country that is one of the first stops for asylum-seekers who cross the Mediterranean Sea to reach Europe, Italy is eager to reduce their number.

Poland and Hungary last week vetoed a statement by EU leaders on priorities for limiting arrivals, and the two countries voted against a June 8 agreement that balanced the obligations of front-line countries against the requirement for other member nations to provide support.

GREECE REBUKES EU BORDER AGENCY'S THREATS TO LEAVE COUNTRY OVER MIGRANT DEATHS: 'UNTHINKABLE'

The governments in Warsaw and Budapest insist that preventing people from entering the EU is a better approach. After her talks with Morawiecki, Meloni said she thinks the bloc will never be able to "find a real solution" to the situation once migrants are already in Europe.

"I believe our position is substantially the same. We want to stop illegal immigration," Meloni said. Referring to the Polish government's position, she added, "I cannot not defend someone who defends national interests."

Polands Prime Minister Mateusz Morawiecki

Poland's Prime Minister Mateusz Morawiecki, right, and Italy's Prime Minister Giorgia Meloni speak during a news conference at the palace, in Warsaw, Poland, on July 5, 2023. (AP Photo/Czarek Sokolowski)

Morawiecki said it was "fundamental" to his government to have the EU's external borders "insulated" and that it also opposed a provision in the June agreement that calls for fining countries that refuse to host a share of asylum-seekers $21,400 per person.

SERBIA BUCKS US, EU; OPENS PROCEEDINGS AGAINST ARRESTED KOSOVO POLICE OFFICERS

Poland has taken in millions of war refugees from Ukraine, some 1.2 million of whom have registered and received the right to live, work, attend school and receive social benefits.

Morawiecki said his government would organize a referendum this year asking Poles for their opinion on accepting migrants who entered the EU illegally. The main ruling party, the conservative Law and Justice, has moved to change Poland's election law to allow the referendum at the same time as the next parliamentary election, expected in the fall.

CLICK HERE TO GET THE FOX NEWS APP

The agenda for Morawiecki and Meloni's talks included regional security in the face of Russia's war in Ukraine, which is seeking NATO security guarantees. NATO's 31 members have a summit scheduled in Lithuania next week.

The two leaders also addressed a meeting of the European Conservatives and Reformists Group, an alliance of the EU Parliament.