THE CRISIS in U.S.-Egyptian relations caused by the prosecution of American-backed nongovernmental organizations (NGOs) and their employees has been partly defused — but in a way that may do as much harm as good. On Thursday six U.S. citizens and seven other foreigners were allowed to leave Egypt after bail of more than $4 million was paid. This will presumably allow them to avoid imprisonment on trumped-up charges of illegal political activity. Yet the trial continues; more than two dozen Egyptian NGO employees remain in jeopardy. The Egyptian government has not retracted its absurd allegations that groups such as the National Democratic Institute, International Republican Institute and Freedom House plotted to overthrow the government and partition the country.

Meanwhile the release of the foreigners has touched off another anti-American backlash in Cairo. Even some liberal Egyptians — including one of the NGO employees being prosecuted — are protesting what they see as an improper intervention in a judicial process by the ruling military council, which is accused of succumbing to pressure from Washington.

The generals deserve the opprobrium. They are responsible for launching a politically motived case and triggering a crisis in relations with the United States. The Obama administration was right to insist that military aid to Egypt would be suspended unless the cases were dropped. But if the regime’s only concession is to allow the foreigners to leave, both the United States and the cause of democracy in Egypt will suffer.

The NGOs are in technical violation of an outdated, oppressive law that Hosni Mubarak’s regime never enforced. It requires all NGOs to be registered and obtain government approval for all funding and grants. The groups filed registration papers years ago but never received a response. With the military’s tacit support, a holdover from Mr. Mubarak’s government used the ambiguity to launch a demagogic campaign appealing to Egyptian nationalism in which the groups were accused of working for the CIA and Israel.

In isolation, the release of the Americans and other foreigners will reinforce nationalist sentiment and conspiracy theories while endangering the Egyptian individuals and groups left behind. The only proper resolution is for the government to register the NGOs, notify prosecutors that it will no longer cooperate with the prosecution, and modify the defective law. Encouragingly, the Muslim Brotherhood, now the largest party in parliament, has said it supports such a liberalization, though the details remain to be worked out.

The generals may suppose that freeing the Americans will be enough to preserve their aid money. It must not be. The Obama administration appears to recognize this: On Thursday, State Department spokeswoman Victoria Nuland said the administration remained concerned about “the ultimate outcome of the legal process” and wanted to see the NGOs registered. Importantly, officials say that no decision will be made on continuing aid until April and that it will be based on a broad assessment of whether Egypt is moving toward democracy, as required by Congress.

The Obama administration has demonstrated that aid to the Egyptian military is not inviolate; it can and should be used as leverage to achieve a transition to democracy. Now the administration must see that transition through.