Ministers were not trying to "cover things up" when they resisted calls for an inquiry into abuse of children in care, a former first minister has said.
Jack McConnell was first minister between 2001 to 2007.
The latest phase of the Scottish Child Abuse Inquiry is exploring reasons why calls for a public inquiry were previously resisted by ministers.
Lord McConnell said ministers had tried "to do the right things" by survivors and children who might go into care.
The current inquiry, heard before Judge Lady Smith, was set up in October 2015 and is investigating abuse of children in care in Scotland or where their care was arranged in Scotland.
The latest phase is looking at calls for a public inquiry made between August 2002 and December 2014.
Lord McConnell said: "The core decision was about trying to do the right thing - not to impress the public, or the parliament, or to cover things up.
"I think the majority of people involved were trying to achieve the right outcome."
He said he was "very clear from the first conversation" that there would be an apology.
Lord McConnell said: "I wanted to ensure the timing and delivery were appropriate to give a strong feeling to survivors that it was a genuine and heartfelt apology.
"In my own head, there was never any doubt from the first discussion in 2002, that at the right minute I'd deliver an apology and that it had to be done by the first minister, and in the strongest possible terms."
Lord McConnell also said he felt that the committee choosing a package of measures as a resolution for abuse survivors was "incomplete".
He said: "My objective was to give some way for survivors to record their experience and influence any aspect of policy still to be dealt with.
"I felt that even if no further improvements were made to the care system, the very experience of being heard was important for survivors."
Judge Smith asked how survivors felt about a full public inquiry, saying: "Can you recall if there was a range of opinions - at one end you had survivors who were very anti an inquiry and the other you have people pushing for one?"
Lord McConnell responded: "I would say more uncomfortable rather than anti - there were survivors who were uncomfortable with the idea of an inquiry."