After hours of discussion here on Sunday, Ms. Merkel emerged speaking of increased “good will” and a good discussion, which would have been impossible given the time constraints of a normal summit meeting. She said that all agreed that countries of “first asylum” should not bear undue burdens, that “all countries should share all the burdens” of migration and that migrants should not be able to decide for themselves where to apply for asylum.

“We all agree that we want to reduce illegal migration, that we want to protect our borders and that we are all responsible for all topics,” Ms. Merkel said. “It cannot be the case that some only deal with primary migration and others only with secondary migration. Everybody is responsible for everything. Wherever possible we want European solutions. Where this is not possible we want bring those who are willing together and find a common framework for action.”

The Italian government in particular has begun to turn away ships containing migrants rescued at sea, forcing them to try to find other countries to land their human cargo. It is currently in a spat with Malta, which is refusing to accept a German ship with 234 rescued migrants already turned away from Italy.

Spain’s new prime minister, Pedro Sánchez, urged other states to help Spain deal with the arrival of thousands of migrants from Africa across the Mediterranean Sea. Spain has seen a sharp rise in migrant arrivals. The United Nations says that around 40,000 people have arrived in Europe by sea so far this year, some 16,000 in Italy, 12,000 in Greece and 12,000 in Spain.

“It was a frank discussion in which we saw the things that unite us but also some discrepancies,” Mr. Sánchez said. “It was a good step forward.”

He said that there was an important consensus “on the need to have a European vision, a common response to a European challenge, which is how to manage the migration flow.”

President Emmanuel Macron of France cautioned that Europe must live up to its values, and he has suggested, like Ms. Merkel, solutions by willing countries to make progress now since unanimity among the 28 member states will be difficult. He has also said that he favors punishing member states that do not show solidarity on the migrant issue. With his own position safe, Mr. Macron said that with migration numbers down, “today’s challenge is one of political pressure in certain member states and what we call secondary migration within the European Union.”

Europe would beef up its own border force, he said, and strengthen efforts to work with countries like Libya and Balkan states, through which many migrants travel.