The photo of the 68-year-old Barton was posted on an anonymous Twitter account just before Thanksgiving and Barton apologized. But he also suggested he could be the victim of online exploitation by a woman he'd had a relationship with whose name has not been released.
About a week later, tea party organizer Kelly Canon revealed Facebook Messenger exchanges from 2012 in which Barton asked if she was wearing panties and made other sexual references. Now twice-divorced, Barton was still married to his second wife at the time of their online exchanges.
Canon said her relationship with Barton never advanced beyond the messages. She said Barton hadn't apologized for them and that she hadn't asked him to - but she also called on him to resign so that his private life couldn't be used against him and other Republicans during 2018 congressional elections.
In announcing that he would retire next year, Barton made no mention of the embarrassing revelations.
"I am very proud of my public record and the many accomplishments of my office," he said in a statement. "Now is time to step aside and let there be a new voice."
Canon said she was happy that Barton had "finally came to his senses."
"I am very relieved that we do not have to fight that battle," the tea party activist said by phone after Barton's announcement. "It would have been a feeding frenzy and it would have affected so many other races."
Though his seat remains safely Republican, Barton this week had drawn a little-known challenger for Texas' March primary and could have faced others. Immediately after his retirement announcement, Texas Republicans began lining up to replace him.
Before Barton decided to retire, political pressure on him to quit had increased. The Republican Party chairman in his North Texas home county of Tarrant called on him to step aside this week and began being joined by Republican members of the Texas' state Senate.
A former oil and gas consultant, Barton was first elected to Congress in 1984 and his retirement now means a whopping seven of the state's 36 members of Congress aren't seeking re-election. All but two of those open seats are Republican.
Barton, who is from Ennis, just south of Dallas, is vice chairman of the House Committee on Energy and Commerce and manages the Republican team that was practicing for a charity congressional baseball game in June when a gunmen opened fire, seriously wounding one congressman.
He's a member of the Freedom Caucus, a group known for sometimes clashing with Republican leadership on conservative issues.
Barton was the only Texas congressional Republican to say he would support a proposed immigration package that would provide protections for immigrants who were brought to the U.S. illegally as children. If approved, that could be an alternative to the Obama administration's Deferred Action for Childhood Arrivals program that President Donald Trump says he will do away with.
Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.