An Afghan man who had faced the death penalty for converting to Christianity is seeking asylum in another country, the United Nations says.
Abdul Rahman converted to Christianity 16 years ago
Mr Rahman, a Christian for 16 years, was charged with rejecting Islam but his case was dismissed because of gaps in evidence, Afghan officials said.
A UN spokesman said he expected asylum would be granted by a country "interested in a peaceful solution".
Several hundred people protested on Monday against the case's dismissal.
UN spokesman Adrian Edwards said the organisation was working with the Afghan government to solve the asylum issue.
US State Department spokesman Sean McCormack said he understood Mr Rahman would be released.
"I understand now that the details of his release and any potential onward travel are being handled as a private matter," Mr McCormack said.
Mr Rahman was arrested about two weeks ago and under Afghanistan's Sharia legal system could have faced execution if he had refused to renounce Christianity.
More than 1,000 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.
In Kandahar, resident Mohammad Salam told the French news agency AFP: "If we are Muslims, then we should kill him. If we don't, we have stood against the will of God."
But there has also been anger in many of Afghanistan's Western allies at the treatment of Mr Rahman.
Many Afghans are not happy with the decision to dismiss the case
The US, Britain, Canada, Germany, Italy and Sweden were among those demanding Afghanistan respect international laws on freedom of religion and human rights.
The two arguments have created great difficulties for the Afghan government and the country's President Hamid Karzai.
Mr Rahman's family had asked the Supreme Court to dismiss the case against him, saying he suffered from mental illness.
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".
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.