A Missouri man spent nearly 17 years behind bars for robbery until his doppelganger was discovered — and the other guy looked so much like him that authorities decided to toss out his conviction.

“This has been one of the most bizarre scenarios that I’ve seen in my 27 years of prosecuting cases,” Johnson County District Attorney Steve Howe admitted Monday as he announced he was dismissing charges against Richard Anthony Jones.

Howe added that he is not planning to retry Jones, the Kansas City Star reported.

Jones, 41, had been serving a 19-year jail sentence for a 1999 robbery when he heard other inmates buzzing that another prisoner looked just liked him — and even shared his first name, Star said.

It’s unclear what the other man was locked up for, and Jones never saw his doppelganger. But he told two legal interns assigned to his case about the rumors, according to Alice Craig, one of Jones’ lawyers.

The interns brought the message back to their superiors at the Midwest Innocence Project and the Paul E. Wilson Defender Project, who dug further into the case.

It turned out that not only did the other man bear an uncanny resemblance to Jones, he also lived closer to the site of the crime.

Jones’ doppelganger, Ricky Amos, used to live with his mother in Kansas City, Kansas, near the address of the incident, Craig said. Jones lived across the state line in Kansas City, Mo.

“When I saw that picture, it made sense to me,” said Jones, who has denied committing the robbery, to the Star.

“Either you’re going to think [we’re] the same person, or you’re going to be like, ‘Man, these guys, they look so much alike.’ ”

His lawyers showed the two men’s photos to the victim, two witnesses and the prosecutor in Jones’ case — and all four admitted they could not tell the pair apart, according to the Star.

While stopping short of accusing Amos — who denied committing the crime at a hearing last week — a judge determined that based on the new evidence, authorities no longer had enough information to support Jones’ conviction. The next day, Jones was a free man.

Jones was accused of mugging of a woman in a Walmart parking lot. He lost several appeals over the years, the Star reported.

There was no DNA, fingerprint or other physical evidence that linked Jones to the crime, and prosecutors had only used eyewitnesses’ testimonies to convict him, the paper reported.

The lineup of photos shown to the victim and other witnesses was “highly suggestive” because Jones was the only person who fit the description of a Hispanic or light-skinned black man, his lawyers told the Star.

“Everybody has a doppelganger,” said one of Jones’s lawyers, Alice Craig. “Luckily, we found his.”