The row flared on Monday after Barton tweeted a response to the news his Marseille team-mate Loic Remy had chosen to join QPR ahead of Newcastle, suggesting managing director Derek Llambias might be one of the reasons the France international did move to the north-east club.
Hamann replied to tell him to keep out of the politics of his former clubs, and that began a bitter row with Barton making a series of personal allegations and insinuations about the former Liverpool midfielder as well as calling him a "maggot" and a "dog".
On Wednesday night he posted a statement on his personal website to apologise for the incident.
It read: "On Monday evening tweets exchanged between Dietmar Hamann and I went beyond the boundaries of banter, opinion and common sense.
"I accept that my comments were offensive, untrue and related to matters of a personal nature, of which I had no knowledge.
"I have apologised to Dietmar personally and now wish to apologise through the same social media channels that I used to make them, as well as my own website.
"I appreciate my comments have caused Dietmar and his family some distress and I fully regret that.
"I also appreciate that my comments should not have been made, as they could have damaged Dietmar's reputation, which should
remain intact as a fantastic player and ambassador for German Football, as well as the game in general.
"Dietmar and I have now agreed to draw a line under the unfortunate exchange and neither of us will be making any further comments on the subject."
Barton and Hamann, who has previously admitted to having a gambling problem, played together briefly at Manchester City.
Barton is currently on loan at Marseille from QPR after the club lost patience with him following his high-profile dismissal against City on the final day of last season and subsequent behaviour.