WHEN it struck a deal to swap asylum-seekers arriving in Australia by boat for refugees from camps in Malaysia, Julia Gillard's government hoped it had at long last found a way to defuse one of Australia's loudest political rows. But on August 31st, in a crushing blow to the government, Australia's High Court ruled the deal unlawful. It ordered the government not to send any asylum-seekers to Malaysia.

On July 25th the government had announced that Australia would send the next 800 seaborne asylum-seekers to join about 90,000 others who have been waiting in Malaysia to have their refugee claims heard there. In return, Australia would take from Malaysia 4,000 people who had been approved as refugees there and were awaiting resettlement in a third country with policies for taking such refugees. That side of the deal, at least, is working: they have already started arriving.

At the other end, the number of Australia's boat people is in fact relatively small. Over twice as many asylum-seekers come in by air. Last year 134 boats carrying 6,535 asylum-seekers sailed into northern Australian waters. Yet by August 22nd this year only 36 boats carrying 2,183 people had arrived. Most of them are held at Christmas Island, an Australian territory off the north-west coast.

Yet a campaign about “border protection” by the conservative Liberal-National opposition, backed by radio “shock jocks” and tabloid journalists, had scored points in suburban Australia. Ms Gillard claimed the Malaysia deal was designed to thwart people-smugglers, and to deter people from dangerous sea voyages. But it was also about sending a signal to voters that the government was getting tough.

On August 7th, just as the first boat people were about to be sent to Malaysia, the High Court, Australia's final appeal court, issued a temporary injunction against the deal. Lawyers argued that because Chris Bowen, Australia's immigration minister, could not guarantee their protection, he had no power under Australia's Migration Act to send them to Malaysia. Unlike Australia, it is not a party to the United Nations Refugee Convention. In striking the deal down, the High Court agreed that the minister had no power to remove from Australia asylum-seekers whose claims for protection had not yet been determined.

The verdict came ten years after the former coalition government introduced a harsh boat-people regime dubbed the “Pacific Solution”. It sent asylum-seekers to languish in Australian-built camps on Nauru and on Manus Island in Papua New Guinea. Critics claim Ms Gillard's Malaysia Solution is the Pacific Solution in new clothes. On August 19th the government signed a memorandum of understanding with Papua New Guinea to reopen an assessment centre on Manus Island.

The court's decision has stunned the government. Some legal experts believe it may now rule out using Nauru and Papua New Guinea as well. But the political assumptions behind the Malaysia Solution seem questionable. It has not made the Gillard government more popular. And an opinion poll on August 16th found that 53% of Australians believed asylum-seekers arriving by boat should be allowed to land and be processed in Australia; only 28% wanted them deported.