In 2003 the Supreme Court struck down state laws that made homosexual conduct a crime, and overnight, prosecutions under so-called "sodomy" laws ended.

But for some, the decision came too late — their charges were logged in court files and subject to background searches.

That's what brought a Nashville man this summer to seek out attorney Daniel Horwitz. The man sought expungement, the clearing of his record.

"There was a conviction on there," Horwitz says, "and that conviction, once I pulled the file, was a 1995 misdemeanor conviction for homosexual acts."

He'd not seen such a case, and was surprised to find one from the mid-1990s. Tennessee ended its Homosexual Practices Act in 1996.

"It's extraordinary to most people that these prosecutions even occurred at all," he says. "But this gentleman had a problem."

Twenty-one years ago, the man seeking expungement was issued a citation for something that took place in his apartment. He went to court and pleaded guilty.

He is identified only as a John Doe for fear of being outed, and declined to be interviewed.

"As most people know, criminal convictions follow you, and lots of people will not hire you if you have them," Horwitz says. "Somebody pulls a criminal background check and it doesn't come back completely clean, people are often ineligible for housing, ineligible for employment, and discriminated against in all sorts of areas of civic life."

For Horwitz, expungements are routine — but not this one. The defendant's guilty plea complicated matters, and the passage of so much time — the window for an appeal was one year from the conviction — seemingly left no legal path. The fact the Supreme Court had struck down sodomy laws was not enough.

"So we had to dust off the textbooks and find a new way to move forward here," he says.

His "a-ha moment" was hitting on an old common law doctrine called the writ of "audita querela," which hadn't been used successfully in a Tennessee courtroom in at least a century, Horwitz says. This rarely used writ was available in this case because all other legal approaches had been exhausted, and because, Horwitz argued, a new legal defense had come into existence since 1995.

Horwitz found help in someone unexpected: Glenn Funk, the city's district attorney. The city's top prosecutor and his team handle 100,000 criminal cases a year, and Funk normally isn't inclined to worry about old convictions. But he was struck by what he called the "ingenious" approach by Horwitz, and by a different type of conviction: a moral one.

"I do not believe that people should be punished in a criminal prosecution based on ... based on the way they were born," he says.

The prosecutor joined the filing in favor of expungement.

"In 1995, the police department was enforcing a law that had been enacted by the Tennessee legislature; in 2016, we have the opportunity to correct a wrong — and we're doing that," Funk says.

As of this month, the court clerk is shredding John Doe's records and clearing them from an online database.

Copyright 2016 Nashville Public Radio. To see more, visit Nashville Public Radio.