A Michigan judge has rescinded his decision to grant a convicted sex offender custody of the child, who was born out of an attack on a 12-year-old girl in 2008.

Christopher Mirasolo, 27, was originally awarded joint custody of the boy, who is now 8, by Judge Gregory S. Ross after DNA testing established he was the biological father.

But Ross on Tuesday changed his ruling so that Mirasolo won’t have any parental rights.

He will, however, continue to pay child support.

The judge said he did not know Mirasolo had two criminal sexual conduct convictions — including one stemming from an attack on the mother of the boy — when he issued his original ruling, Michigan Supreme Court spokesman John Nevin told The Associated Press.

“The question that everyone is asking is, ‘How could a judge do such a thing?’” Ross wrote in regard to his original ruling in his decision, which he read in court, the Port Huron Times Herald reported. “The answer is that this judge was not aware, did not have knowledge of the fact that the defendant raped the plaintiff and the child was born as a result.

“The Family Division of the Circuit Court will be reviewing its procedures also,” Ross wrote. “This should not happen to anyone.”

Ross said he was presented with a paternity petition, which he reviewed, and there was nothing unusual in the order.

The order was prepared by the Sanilac County prosecutor’s office, which told CBS This Morning that it prepared a standard order it used in all paternity cases and that the mother was required to cooperate as a condition of receiving financial assistance.