BRUSSELS — After days of recriminations over the sudden arrival of tens of thousands of migrants in the Spanish exclave of Ceuta last week, the EU’s 27 home affairs ministers are expected to use an emergency meeting Tuesday to express solidarity with Madrid and focus on how to prevent a repeat.

However, Spain will also criticize some governments for turning the crisis into an attack on Prime Minister Pedro Sánchez instead of supporting a fellow EU country facing an emergency, according to an official familiar with Madrid’s plans, granted anonymity to speak freely. Interior Minister Fernando Grande-Marlaska will present Madrid’s assessment of the events and make the case for a common European response, the official said.

After initial criticism of Spain, the mood among EU capitals has softened as the immediate crisis eased, according to six diplomats from different countries who were granted anonymity to speak freely. Almost all the migrants who entered the exclave last week have returned to Morocco, Spanish authorities say, and there has been no reported onward movement into mainland Europe.