On Friday the High Court ruled invalid a regulation which gave ASIO an effective right of veto over the release into Australia of refugees (already in our detention camps) whose activities ASIO thinks might pose a threat to Australia's security. It's a decision with likely wider impact, in particular raising questions about whether the government can continue to detain, indefinitely, people whom it has found to be genuine refugees, but whom it does not want. Australia has no intention, of course, of sending people home to persecution, torture, possibly death. There are presently about 50 people, mostly Sri Lankan Tamils, in this position. On the other hand, no other countries will take them either. By our arbitrary focus-group-driven rule, such people must be detained, as if in prison, even though they have committed no offence.

The opposition, ever keen to portray the Labor as ''weak'' on refugees, has suggested that the court has taken away the nation's power to keep security risks from the country, but that is to seriously misrepresent the result. The court had no difficulty with the notion that refugees can be security checked, or that legitimate refugees can be refused protection on security grounds. It had no problems with ASIO's security assessment process, nor did it think that ASIO had failed to accord the refugee natural justice.

The problem was more basic. On the one hand, the Migration Act, adopting and giving effect to our international treaty obligations, had put any such decision in the hands of the relevant minister himself or herself. On the other, the regulations put the decision in the hands of ASIO, and, by at least one line of interpretation, gave the minister no right of independent judgment about the matter. The difficulty could be cleared up with fairly simple amendment making ASIO's advice a recommendation to the minister.

But it is hard to imagine any debate about amendment being confined to the bare point. The case raises yet again the problem of a policy of mandatory detention, but also effective indefinite detention for refugees, and possibly some non-refugees, whom we do not want but have no place to send. Our present policy is to lock up such people until we have a solution, all the while pretending that this has no punitive character but is an administrative matter mandated by Parliament. The policy, shamefully, was endorsed in 2004 by a narrow majority of the High Court, in a decision which attracted a storm of political and legal criticism. Those who have read Friday's decision closely believe that the court, as now constituted, would welcome an opportunity to revisit that case, and would overrule the decision made by different judges seven years ago. If the government were merely to change the law to make an ASIO advice recommendatory, it might be buying only temporary respite from the fundamental dilemma and shame of locking up indefinitely people who have done nothing wrong - people who, for that matter, had a perfect right to ask us for protection.

The case seven years ago involved a Palestinian - effectively a man without a country - whom no other country would take. Friday's involved a Tamil who was a fighter in the Tamil Tigers, one who, moreover, played some counter-intelligence role in identifying Ceylonese spies in the Tiger ranks. Everyone, including ASIO, accepts that he is a genuine refugee. There is little doubt that he would suffer if he were returned to Sri Lanka. ASIO fears, reasonably, that if he were allowed to move into the community, he might continue to agitate Tamil grievances against Sri Lanka, supporting resistance, including the use of violence, to it. It's a risk ASIO says should not be taken. Australia has ample experience of the problems of refugees who have been seemingly unable to forget or leave behind the grievances and conflicts that have brought them here. That many, of course, succeed in making a completely new life is a fact underlining the point that these are matters of sensitive judgment calls by people of background and experience. That other factors are involved is why once, wisely, ASIO had only recommendatory, not executive, functions: it is only when it has actual powers that it finds itself open to such critical and suspicious legal scrutiny.

But appreciation of the security dilemma of ASIO and the government does not have to start with the premise that the choices are confined to detention, refoulement or finding a country willing to take the refugee. The legal and administrative mind is capable of devising any number of variations of supervised or monitored freedom, parole and conditional rights of residence in ways which secure all of the relevant interests. It's about time the politicians responded with imagination and respect for human rights, rather than by reflex fear of shock jocks.