The messages date back to 2017, months before Paine was recalled to the Test team after a seven-year absence and a joint Cricket Australia and Cricket Tasmania investigation cleared Paine at the time.
The development comes weeks ahead of the five-Test Ashes series against traditional rivals England. The first Test begins in Brisbane on December 8.
''Today I am announcing my decision to stand down as captain of the Australian men's cricket team. It's an incredibly difficult decision but the right one for me, my family, and cricket,'' Paine said during a press conference.
''Nearly four years ago, I was involved in a text exchange with a then-colleague.
''Although exonerated I deeply regretted in an incident at a time and I do so today. I spoke to my wife and family at a time and was enormously grateful for their forgiveness and support,'' he added.
Paine will, however, continue to be a part of the Australian team.
Reports claimed a Cricket Tasmania employee was offended by ''Mr. Paine's sexually explicit, unwelcome and unsolicited photograph of his genitals in addition to the graphic sexual comments.'' The 36-year-old was promoted as captain following the ball-tampering scandal in South Africa in 2018.
The board accepted Paine's resignation and has started the process of identifying and appointing the next Test captain.
''We thought this incident was behind us. And that I could focus entirely on the team as I have done for the last three or four years.
''However, I recently became aware that this private text exchange was going to become public. On reflection, my actions in 2017 do not meet the standard of an Australian cricket captain or the wider community,'' Paine admitted.
He added, ''I'm deeply sorry for the hurt and pain that I have caused to my wife, my family, and the other party. I'm sorry for any damage that this does to the reputation of our sport.
''I believe that it is the right decision for me to stand down as captain effective immediately. I do not want this to become an unwelcome disruption to the team ahead of what is a huge Ashes series.'' He added, ''I will remain a committed member of the Australian cricket team, and look forward with anticipation to what is a huge Ashes tour. Thank you.'' CA chairman Richard Freudenstein indicated Paine's decision to step down was his own.
''Tim felt it was in the best interests of his family and Australian cricket to take this decision to step down as captain,'' Freudenstein said.
CA accepted his resignation.
''While the board acknowledges an investigation cleared Tim of any breach of the code of conduct regarding this matter some years ago, we respect his decision,'' CA said in a statement.
''CA does not condone this type of language or behavior. Despite the mistake he made, Tim has been an exceptional leader since his appointment, and the Board thanks him for his distinguished service.'' Paine becomes the second consecutive Australian Test captain in recent years to quit his job owing to a scandal, following Steve Smith's resignation as the skipper in the wake of the ball-tampering episode in South Africa. During correspondence with Australian cricket authorities in June 2018, the woman claimed she was offended by ''Mr. Paine's sexually explicit, unwelcome and unsolicited photograph of his genitals in addition to the graphic sexual comments''. The woman quit her job in 2017.