For a few hours on Wednesday, the Government was in turmoil. The National Court's decision halted the transfer of 1,700 migrants to the port of Ceuta at a critical moment. It had not been publicly announced, to avoid disturbances, but the plan was to move them from the beaches of El Trampolín and Benítez to the port early on Thursday morning.

The Government was furious with the National Court but above all with the Unified Police Union (SUP), which had requested this precautionary measure just the day before the transfer that the police were aware of, because it had been prepared with them to ensure everything would go smoothly. "It cannot be a coincidence — they knew about it and tried to sabotage us," said a Government official. At La Moncloa there was something of a crisis cabinet, as is almost always the case, though not a formal one, but rather a round of calls to explore options and make decisions.

With the President himself overseeing every move and three ministers directly involved — Ángel Víctor Torres, Óscar Puente and Elma Saiz — it was decided to go on the offensive. The Government officially conveyed a message of "bewilderment" and demanded a swift resolution with one clear message: "Ceuta cannot wait."

Even so, by that time of night — 9:30 p.m. — and following the initial shock, the Executive was already beginning to consider the possibility that the National Court might rule that very Thursday and do so in its favour. But it had no guarantees, so it decided to apply maximum pressure. Now, at La Moncloa, they are unable to say whether the judges reacted to their pressure or would have reached this decision regardless, but they believe it was worth making sure.

On Thursday morning, both Puente and Óscar López appeared on several media outlets to maintain that pressure, though with a measured tone unusual for either of them, aware that the ruling could be favourable and that it was not advisable to raise the temperature any more than necessary.

Puente's ministry had sent two dozen extensive documents to the National Court on Wednesday night to demonstrate that everything was in order, that the necessary safety precautions had been taken and that all the required reports supported moving the migrants to the port. "They talk to us about safety, but what is safer — having them at the port in a properly equipped area with bathrooms and showers, surrounded by private security and police officers, or having them in makeshift shacks on the beach, relieving themselves wherever they can?" Government sources insisted that morning.

At that point the Executive was working with confidence in a positive resolution, because they had no plan B. Without the port, their entire strategy for returning Ceuta to a semblance of normality — removing 1,700 migrants from the beaches and dismantling their camps — would fall apart. "They ask us to perform magic. I don't know if people are aware of the size of Ceuta — there are very few options," Puente said on TVE.

There was some anxiety when, by morning, the judges had still not downloaded the documentation sent by the Ministry of Transport, and the idea circulated in judicial circles that documents were missing. This was not the case. As soon as they began reviewing them, the judges swiftly lifted the injunction and the work, which had already been in its final stages on Wednesday when it was halted, resumed immediately.

With this opening of the port location, which the Government has sought from the outset because it was straightforward, fast, large and far from the homes of Ceuta's residents, the technicians who have been working on the ground for weeks are confident of making a very significant leap in their attempt to clear the beaches and change the image of overcrowding that television networks have been broadcasting over the last 45 days.

In fact, the Government had already managed to clear El Trampolín beach once before with another transfer, but it quickly filled up again with migrants coming down from the hills. The same could happen again this time, as more than 1,700 people remain on the streets and in the hills, though their numbers are dwindling and work is already underway on another location for those who remain, who will now be easier to count.

Furthermore, according to various Government sources, the slow trickle of migrants who are giving up and voluntarily returning to Morocco continues, with more than 5,500 since August 10, and in recent days with occasional peaks of 100 per day. The Government is insisting on sending the message that practically no Moroccan will be able to access asylum and therefore their fate is to be returned, in the hope that they will understand it is better to go back voluntarily. But the vast majority continue to stay, waiting to see how events unfold.

The crisis is far from resolved, but the port milestone is crucial to completing the Government's plan to house more than 6,000 people and thereby accelerate the process of returning the overwhelming majority. With the other location currently being considered among several options, the operation could soon be wrapped up, although the Government still does not really know how many people there are.

The latest figures it has provided, covering those housed, those who have voluntarily returned and people still on the streets, exceed 12,000 — the number of people who stayed after the July crossing, the figure initially calculated by the city of Ceuta which the Government had denied.

The number of meals being distributed on the streets can no longer serve as a reliable estimate because it remains almost always the same despite the fact that 4,300 people housed in facilities are eating there, which suggests that some migrants who were already in Ceuta before July 30 are coming to eat, throwing off all calculations.

The crisis has brought to light many people who were living precariously in the city and have now been included among those being accommodated. And counting the people sleeping hidden in the hills is no easy task. The Government plans to expand reception capacity to as many as 10,000 places if necessary, but all with the aim of returning the overwhelming majority.

Meanwhile, the Government is also pressing Ceuta to accept the transfer of minors to the mainland, particularly the 500 most vulnerable girls, some as young as ten, but this has opened up an open conflict with the leadership of the PP, which is radically opposed to sending a single minor to the rest of Spain.

The Government is still sitting on the enormous powder keg that the Ceuta crisis has become, but following the first positive judicial ruling in a long time, the mood at La Moncloa was one of clear euphoria, and an official statement celebrated the "speed" of the National Court.

The Government maintains that the hardest and most discreet work is yet to come: achieving a steady pace in the processing of files for both minors and adults in order to begin returning immigrants at a consistent rate, and to be able to see some light at the end of a crisis that has destroyed the image of a Government that had grown accustomed to all kinds of extreme situations and managed to come out unscathed from all of them, but this time failed to properly gauge the scale of the problem and took far longer than reasonable to begin addressing it. It now believes it is starting to bring things under control, but there may still be many surprises ahead.