Kansas will pay more than $1 million to a wrongfully convicted man who spent almost two decades in prison for a crime committed by someone who resembled him, said state Attorney General Derek Schmidt.

Richard Anthony Jones reached a settlement Tuesday with the state after he sued for its mistake, according to the Kansas City Star.

Jones was sent to prison for robbing and attacking a woman in a Walmart parking lot in 1999. While in prison, other inmates said he looked like another man.

His defense attorneys identified Jones’ doppelgänger and discovered that he and Jones had the same first name and that he lived near where the crime took place, the Star reported.

The robbery victim was shown pictures of Jones and the other man during a court hearing in June 2017 and was unable to confirm whether Jones was the person who robbed her. His conviction was overturned and he was released from prison after 17 years.

“We are committed to faithfully administering the new mistaken-conviction statute,” Schmidt told the Star in a statement. “In this case, it was possible on the existing record to resolve all issues quickly … so Mr. Jones can receive the benefits to which he is entitled by law because he was wrongly convicted.”

His suit against Kansas was the first one under the state’s new law that awards money to individuals who were wrongly convicted.

Jones’ total compensation from the state is $1,103,945, something that his lawyers said was “relatively small given the unfathomable hardship of 17 years of wrongful imprisonment.”