In a beige-walled courtroom in eastern Iowa, a man who has been William Woods for his entire life faced a man who had been known as William Woods for much of his.

That hearing late last month brought an end to what prosecutors called “a Kafkaesque plot that resulted in the false imprisonment, involuntary hospitalization and forced medication” of the real William Woods. And it was the final step in the legal downfall of the impostor, whose true name is Matthew Keirans, who spent decades building a middle-class life in Woods’ name before the truth began to unspool.

Seated at a table 15 feet from Keirans, Woods told a federal judge of his yearslong ordeal, including the time that he was “sent to jail for nothing, for being myself.” A few minutes later, the judge, C.J. Williams, sentenced Keirans to 12 years in prison, saying he had stolen Woods’ identity and “manipulated the criminal justice system to prosecute an innocent man.”

“What the victim was deprived of here was priceless,” Williams said. “It’s freedom.”

It was a case that raised basic, painful questions about justice: What happens when your name is no longer your own? And whom does the system believe?

‘That’s me’

More than five years ago, William Woods stood in another courtroom. He was the defendant, and the Los Angeles County District Attorney’s Office did not believe he was who he said he was. Prosecutors believed he was Keirans.

“There is an issue I need to raise with the court,” a California prosecutor said in 2019, according to a transcript. “As the court knows, this is an identity theft case. We filed it under Matthew Keirans because the named victim in this case is William Woods.”

“That’s me,” Woods called out.

“And I understand he’s insisting he’s William Woods,” the prosecutor continued.

“I can prove it,” Woods told the judge.

Woods was held without bail on charges that he had illegally tried to gain access to bank accounts that Keirans had opened in Woods’ name. At every step, Woods insisted that he was telling the truth about his identity. At every step, the system doubted him.

Woods, 56, had spent much of his adult life striving but struggling. Friendly and soft-spoken, he had often been homeless, bouncing between New Mexico and California and working as a hot dog vendor or making jewelry to get by.

He was consistent and clear when he talked about his identity in California courtrooms as he tried to fight the charges on the grounds that he really was the man whose name he was accused of stealing. But Woods made other remarks that seemed to amplify the doubts. In court appearances, transcripts show, he would sometimes interrupt the judge, talk about historical figures or assert that he had tried to warn the FBI in advance of the Sept. 11, 2001, attacks.

When his court- appointed lawyer told a judge “I do not believe that he is competent,” it set off a series of events that led Woods to spend nearly five months in a California psychiatric hospital, in addition to the 428 days he spent in the county jail. The Los Angeles County Alternate Public Defender’s Office, which represented Woods, declined to comment.

Woods pleaded no contest in the bank account case when given the chance to be sentenced to the time he had already served. The doubts lingered.

Prosecutors in Los Angeles asked the judge to order Woods not to use his name. When a judicial assistant noted that Woods insisted that he was in fact Woods, the judge overseeing that case pushed back.

“That’s because he was crazy,” the California judge said, according to the transcript of the proceeding in 2021.

Asked about that hearing, a spokesperson for the Superior Court of Los Angeles County said the judge was prohibited from commenting, and “judges rely on the parties before them to provide accurate information.”

‘Had I known’

Halfway across the country, Matthew Keirans had established a quiet, successful life. He had married and raised a son whose surname is Woods. He lived in a middle-class neighborhood in suburban Milwaukee. He worked remotely for the University of Iowa’s hospital, where he was a high-level information technology administrator. He was, to everyone who knew him, William Woods.

“Had I known, we could and would have righted his wrongs decades earlier,” his wife wrote recently in a letter to the judge asking for leniency. “In all other aspects, Matt has been faithful.”

The details of how Keirans came to be known as Woods are fuzzy at best. Reached in jail, Keirans, 58, declined to be interviewed, and his court- appointed lawyer did not respond to interview requests.

But court documents show that the two men’s lives intersected briefly in the late 1980s in Albuquerque, New Mexico, when, prosecutors said, both were homeless and working at hot dog carts. Woods believes his co-worker stole his wallet, learned his personal details and started using his identity. Federal prosecutors say they found no evidence of Keirans using his real name after 1988.

On Friday, Williams said Keirans’ motive was clear: He had adopted the false identity to escape responsibility from crimes he was accused of when he was young. Keirans had run away from home as a teenager, stolen a car and skipped court after an arrest, his plea agreement says.

In 1990, Keirans used Woods’ name to obtain a Colorado identification document while working as a newspaper carrier, he has admitted.

In the years that followed, he used the Woods name for taxes, insurance, driver’s licenses, vehicle registrations, titles, deeds and bank accounts, the plea agreement says.

Keirans used Ancestry.com to find information about Woods’ family, which helped him obtain Woods’ real birth certificate from Kentucky. When Keirans provided that document to investigators in Los Angeles, it helped convince them that he was the real Woods.

All of the records that Keirans accumulated establishing himself as William Woods left the real Woods unable to convince the authorities that he was who he said he was, though he, too, had identification cards with his real name.

Over the years, as Woods called police departments and banks and credit monitoring agencies trying to restore his name, he got nowhere. The authorities in California thought he was lying. When Woods contacted the police in Wisconsin, where Keirans lived, they appeared to accept Keirans’ version of events, records show, even relaying their findings to officials in Los Angeles at Keirans’ request.

It was not until Woods contacted the University of Iowa, where Keirans was employed in Woods’ name, that he found an investigator who took him seriously enough to find the truth.

“One of these two men was a victim of a crime,” Detective Ian Mallory of the university police said after the court hearing in late January. “I did not know which one.”

After Woods set off the investigation in Iowa, Keirans worked to convince investigators that he was the real Woods, just as he had done with the authorities in California and Wisconsin when they pursued the case. Keirans kept following up with Mallory, claiming that he was the true victim and needed the detective’s help.

But unlike the other investigators, Mallory arranged for DNA tests of Woods’ father in Kentucky — whose identity was certain — and of Woods, who was then spending time at a shelter in Santa Monica, California.

A comparison of the results showed that the California man was telling the truth.

Armed with the DNA evidence, Mallory interviewed Keirans. He tripped up when asked the name of his father and then confessed, according to court documents.

‘The truth’

Woods’ life changed last year when Keirans pleaded guilty. The Los Angeles County District Attorney’s Office requested that Woods’ conviction be vacated. He was profiled in the Los Angeles Times. His inbox filled with emails from lawyers and journalists and filmmakers.

But life remained difficult, and money was hard to come by.

Woods passed many days at a downtown Albuquerque barbershop, just blocks from where he worked as a hot dog vendor all those decades ago. He kept his food in the barbershop’s fridge, used the bathroom to shave and helped sweep up customers’ hair.

Woods slept some nights outside a truck stop beside the interstate and got around town by bus. Still, he had his name back. He had hope.

As the months passed, Woods found an apartment and began a landscaping job that he enjoys. He hired a law firm to seek compensation for his wrongful conviction in California. And recently he traveled to Cedar Rapids, Iowa, walked inside a courthouse and watched as the man who took his name learned his prison sentence.

“The truth is known,” Woods said afterward. “The truth is let out. And the truth is important.”

In that courtroom, everyone knew which man was William Woods.