Several hundred people have protested in northern Afghanistan against a decision to dismiss a case against a man who converted to Christianity.
Many Afghans are not happy with the decision to dismiss the case
Abdul Rahman's case has been handed back to the attorney-general because of gaps in the evidence, an official said.
The decision to release Mr Rahman came amid mounting international criticism over the issue.
Mr Rahman, a Christian for 16 years, was charged with rejecting Islam and potentially faced the death penalty.
Afghanistan's legal system is built on Islamic Sharia law, and Mr Rahman could have faced execution if he had refused to renounce Christianity.
The Afghan government has come under considerable domestic pressure over the case, says the BBC's Sanjoy Majumder in Kabul.
More than a thousand protesters took to the streets in the northern city of Mazar-e-Sharif on Monday morning.
They demanded that Mr Rahman be tried and executed for converting to Christianity.
With chants of "Death to Bush!", they warned the international community to keep off the case.
Afghanistan has an Islamic constitution which must be respected, they said.
It is a measure of the difficulties confronting the Afghan government and the country's President Hamid Karzai.
Abdul Rahman converted to Christianity 16 years ago
Mr Karzai has personally intervened in the case, mindful of the growing international pressure, much of it from countries which are his closest allies.
At the same time, he faces considerable opposition from religious hardliners both within and outside his administration. He will be hoping that the case can be disposed of and the damage limited before it gets out of hand.
Details of Mr Rahman's imminent release are being kept secret, as feelings in Kabul have run high over the case.
Earlier, Mr Rahman's family asked the court to dismiss the case against him, saying he suffered from mental illness.
Some reports say Mr Rahman was taken to a mental institution on Monday for tests.
Supreme Court Judge Ansarullah Mawlavizada told the BBC there was considerable doubt that Mr Rahman was fit to stand trial.
According to Judge Mawlavizada, Mr Rahman appeared "disturbed".
He said the accused man's relatives had told the authorities he was insane and that they claimed Mr Rahman had said he heard strange voices in his head.
The judge also said it was not clear if the accused was really an Afghan or a citizen of another country.
Mr Rahman has lived outside Afghanistan for 16 years and is believed to have converted to Christianity during a stay in Germany.