The Massachusetts Supreme Judicial Court agreed on Friday to allow DNA testing in the case of a mildly retarded man sentenced to life in prison for the rape and murder of an elderly woman with Alzheimer’s in Lakeville more than 20 years ago.

Robert Wade, 65, was charged with raping Johanna Francescon, 84, the mother of the man who employed him on a Lakeville pig farm. She died three weeks later of pneumonia while hospitalized for a broken hip that she suffered in the attack.

On Oct. 24, 1993, Francescon’s son said he found his mother and Wade, both naked, in the shack where Wade lived on the farm. The elderly woman was sprawled on his bed.

During the trial, Wade’s lawyer argued that the sex was consensual and that Franceson was “hypersexual” because of her Alzheimer’s.

At the time of the trial, DNA testing was available but still new, and neither the prosecution nor the defense sought it.

However, tests conducted on blood and semen samples taken from Francescon and her clothes indicated that the fluids might have come from another person in addition to Wade.

According to a statement issues by the Plymouth County district attorney’s office, “the jury heard evidence at trial that the blood groupings showed that Wade could be excluded from one, but not all, of the sources on the victim’s pants but could not be excluded from the sample from her vagina.”

Now, two decades later, Wade argues that he is entitled to DNA testing he claims would support his innocence.

His case was the first to test the parameters of a 2012 state law that provides a mechanism for defendants to seek DNA testing after they are convicted.

On Friday, the Supreme Judicial Court agreed with Wade’s argument and granted him an evidentiary hearing regarding the DNA evidence.

Lower state courts and the Supreme Judicial Court had previously denied Wade’s appeals for DNA testing.

“The court found that defendant’s recent claim that he did not rape the victim because he was too drunk to complete the sexual act was a sufficient claim of factual innocence under the statute to warrant an evidentiary hearing,” according to the district attorney’s office.

Wade has claimed that he would not have been able to have sex the day the woman was attacked because he had consumed a 12-pack of beer, a 6-pack of beer and three bottles of wine.

The Supreme Judicial Court also ruled that Wade’s lawyer did not provide him with effective counsel in not seeking the DNA testing.

“In effect, this interpretation of chapter 278A relieves the defendant of the statutory burdens set forth by the Legislature in that statute, particularly as to the defendant’s claims of factual innocence and effectiveness of trial counsel,” according to the district attorney’s office.