The deputy chief judge of the court that sentenced Sayed Pervez Kambaksh to death said the student should have the right of appeal with legal representation if this had been denied.
Judge Mohammed Omar Ishaqzai added that Mr Kambaksh, 23, should be allowed to have the appeal case heard in Kabul if he felt that he would get a fairer hearing in the capital.
He also criticised the Afghan senate for approving the death sentence before the appeal procedure had been exhausted, saying this amounted to political interference. "The senate later had to retract that ruling and that was the right thing to do," he said.
But Judge Ishaqzai said many Muslims were angry at what they consider to be Western double standards, by allowing "insults to Islam" such as the publication of the Danish cartoons about the Prophet Mohamed.
The judge, who was not involved in the original trial, has been asked to review the legal procedure that led to the death sentence for downloading "unislamic" internet reports on women's rights. Asked what type of heresy Mr Kambaksh had been guilty of, Judge Ishaqzai said: "I am afraid I do not know the details."
Mr Kambaksh has told The Independent at the prison where he is being held in Mazar-i-Sharif that his trial lasted just four minutes; he was not allowed to speak in his own defence and had no legal representation.
Judge Ishaqzai said: "Our law makes it very clear that a defendant has the right to have a lawyer and challenge any evidence presented against him. If this did not happen then he now has two appeals where he can be represented by lawyers and the judges can take a fresh look at the evidence."
The Independent's campaign to save the Afghan student Pervez Kambaksh has attracted more than 93,000 signatures. You can still add your voice to the campaign to spare his life. Sign our e-petition at www.independent.co.uk/petition