A D.C. Superior Court judge on Friday officially exonerated Kirk L. Odom, wrongfully imprisoned for more than 22 years in the rape and robbery of a woman in her Capitol Hill apartment in 1981.

“Mr. Odom has been the victim of a grave miscarriage of justice. He is actually innocent of the crimes for which he was convicted,” Judge Herbert B. Dixon wrote in a three-page order that vacated Odom’s convictions on the basis of new DNA testing that proved he was not the perpetrator.

Odom completed his prison term in 2003. But the order frees him from having to register as a sex offender and from remaining on parole until 2047, and it allows him to seek compensation from the government.

“Oh my God, that is a very beautiful birthday gift,” Odom, who turned 50 Friday, said in a statement released by his attorney, Sandra K. Levick, chief of special litigation for the D.C. Public Defender Service.

Odom maintained his innocence since before his 1982 trial and sought new DNA tests in February 2011. The Washington Post has reported that Odom is the third D.C. man convicted of rape or murder to have his charges vacated since 2009 based on erroneous forensics and testimony by FBI hair experts.

Odom was also identified by the victim, and the D.C. Public Defender Service called his case “a cautionary tale of the perils of eyewitness identification evidence.” In its statement, the defender service called on the District to adopt legislation that would prohibit the administration of photo arrays by people familiar with a case or suspect. Lawmakers have mandated or police have voluntarily adopted such measures in several states, but similar proposals have died before the D.C. Council twice since 2008.