Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Rep. Joe Barton, R-Texas, announced Thursday that he will not run for re-election next year — just days after his nude photo and a salacious text surfaced on social media.

"As a young congressman, my slogan was 'listening to you in Texas, working for you in Washington,'" Barton, 68, said in a statement. "It has been a tremendous honor to represent the 6th District of Texas for over three decades, but now it is time to step aside and let there be a new voice."

Rep. Joe Barton questions witnesses during a House Energy and Commerce Committee hearing concerning federal efforts to combat the opioid crisis, Oct. 25, 2017 in Washington. Drew Angerer / Getty Images file

Barton, who represents a district south of Dallas, was in the national spotlight last week after a close-up photo of his genitals first appeared on an anonymous Twitter account, along with a lewd message he had written, about a month after he had announced his intention to seek re-election.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Barton confirmed the authenticity of the photo and text and expressed regret. He later said he might have been a victim of a crime.

"While separated from my second wife, prior to the divorce, I had sexual relationships with other mature adult women," he said at the time. "Each was consensual. Those relationships have ended."

"This woman admitted that we had a consensual relationship," Barton said. “When I ended that relationship, she threatened to publicly share my private photographs and intimate correspondence in retaliation. ... I offered to take the matter to the Capitol Hill Police to open an investigation."

The Dallas Morning News reported that the photo of Barton could violate a Texas law banning "revenge porn," which makes it illegal to distribute such images without consent.

Barton, who was elected in 1984, is the longest-serving member of Congress from Texas.