The Sun has apologised to former prime minister Gordon Brown for claiming he had accused the newspaper of blagging details of his son's medical records for its revelation that his son had cystic fibrosis.

The apology follows the row over the origin of the front page story, which ran in 2006 and has been the subject of several heated exchanges between Brown, the newspaper, and its former editor Rebekah Brooks ever since.

The Sun on Thursday said sorry for comments made by its associate editor Trevor Kavanagh in a column on 12 November repeating the erroneous allegation that Brown had accused the Sun of blagging.

"In Trevor Kavanagh's column of 12 November, it was stated that Gordon Brown accused the Sun of blagging his son's medical records," the paper said in an apology printed on page 2.

"In fact, Mr Brown has never made such an accusation, in parliament or otherwise. We were wrong to use this erroneous allegation as a basis to make comments about his character and integrity and to suggest that Mr Brown was 'not telling the full story'. We withdraw these criticisms and apologise to Mr Brown."

Brown has always said that he couldn't understand how the medical condition of his son got into the public arena and the Sun has always denied blagging.

Last year at the Leveson inquiry Brown rubbished claims by Brooks, the editor of the paper in 2006, that he and his wife had given him the go-ahead for a story on his son's illness.

Brooks had said that the Browns had consented to the article which revealed that four-month-old Fraser had the condition.

Brown told Lord Justice Leveson that "no parent in the land" would have given permission to have their child's medical details made public. He said the call from Brooks telling him they were running the story had left him in tears.

"We were presented with a fait accompli," he said. "There was no question of us giving permission for this – implicit or explicit."

The Sun has always denied getting access to his son's medical records. Last year News International said a source had come to the Sun voluntarily as he wished to highlight the plight of those with the disease, adding that he had provided "a written affidavit" confirming this.

Last June following the testimony of Brooks and Brown at Leveson, NHS Fife chief executive John Wilson apologised to Brown after an internal inquiry found it was "high likely" details of his son's condition were disclosed by a member of staff.

Brown complained to the Press Complaints Commission about the latest repetition of the erroneous claim that he had accused the Sun of blagging the information.

The former prime minister has had four other clarifications published in the Sun since last October.

Richard Caseby, managing editor of the Sun, said: "I'm pleased that Mr Brown is now finally on record confirming he has never accused the Sun of illegally accessing his son's medical record."

• To contact the MediaGuardian news desk email media@theguardian.com or phone 020 3353 3857. For all other inquiries please call the main Guardian switchboard on 020 3353 2000. If you are writing a comment for publication, please mark clearly "for publication".

• To get the latest media news to your desktop or mobile, follow MediaGuardian on Twitter and Facebook.