Paine, 36, had been expected to lead his side in the series against England which starts in Brisbane on December 8, but made the “incredibly difficult decision” to leave the role.
The wicketkeeper-batsman did not speak about the nature of the messages in his resignation speech, but Cricket Australia’s (CA) news website referred to it as “revelations of a sexting incident involving a former Cricket Tasmania employee in 2017”.
CA said it accepted the resignation and would appoint a new captain, but added the Tasmanian would be available for selection for the forthcoming series.
Paceman Pat Cummins is the current vice-captain and most likely choice to become the team’s new leader.
Speaking to reporters in Hobart, Paine said: “It’s an incredibly difficult decision but the right one for me, my family and cricket.
“As a background on my decision, nearly four years ago I was involved in a text exchange with a then colleague.
“At the time, the exchange was the subject of a thorough CA (Cricket Australia) Integrity Unit investigation, throughout which I fully participated in and openly participated in.
“That investigation and a Cricket Tasmania HR investigation at the same time found that there had been no breach of the Cricket Australia code of conduct.
“Although exonerated, I deeply regretted this incident at the time and still do today.”
Paine was unexpectedly elevated to become Australia’s 46th Test captain after Steve Smith’s ban following the infamous ball-tampering scandal in South Africa in 2018.
While the position was thrust upon him, the 36-year-old has drawn mostly praise for his execution of the demanding dual roles of captain and wicketkeeper, especially in Australia’s 2019 Ashes triumph in England.
He added: “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.
“I am deeply sorry for the hurt and pain that I have caused to my wife, my family and to the other party.
“I am sorry for any damage that this does to the reputation of our sport and 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,” added Paine, who captained Australia in 23 Tests for 11 wins, eight losses and four draws.
“I have loved my role as captain of the Australia cricket team and it has been the greatest privilege of my sporting life to lead the Australian men’s Test team.”
While Cummins is seemingly first in line to take over from Paine, Australia has typically been extremely reluctant to have a bowling captain. Their last was leg-spinning all-rounder Richie Benaud, in the early 1960s.