The former Post Office communications director said he has asked himself whether the company might have been “the baddies” throughout the Horizon scandal but insisted the business “tried to do the right things”.

Mark Davies told the Horizon IT inquiry that he conceded some of the numerous emails he had written “blaming the journalists” who were campaigning on the issue “look ludicrous” with the benefit of hindsight.

Mr Davies said he “certainly” heard about the communications director job vacancy at the Post Office through his connection with former boss and ex-Labour home secretary Jack Straw.

The witness submitted a statement to the inquiry, in which he heaped praise on former chief executive Paula Vennells for developing a culture of “care, commitment and challenge”.

The probe was shown an email from Ms Vennells from August 2015, in which she said she did not “wish to give any legitimacy” to a BBC Panorama programme which highlighted “back door” access to accounts on the Horizon system.

Mr Davies denied that wanting to line up a “specialist media lawyer” hours after the suicide of subpostmaster Martin Griffiths in September 2013 was because of wanting to combat negative publicity.

He told the inquiry the request for a lawyer’s assistance was because he wanted guidance on reporting suicide.

Emails from Mr Davies about media coverage of the scandal were also displayed at the inquiry, with one showing him joke about being “at the heart of a corporate cover-up”.

The message, sent to Post Office colleagues in January 2015, read: “It’s fascinating to be part of a conspiracy. To be at the heart of a corporate cover-up.

“But frustrating too, when the reality is a hard story to tell, and some distance from the picture painted by a determined band of adversaries.

“In our case, we are up against a campaign group, a few journalists (mainly from the BBC) and some MPs.

“And you have to hand it to them: they know what they are doing in terms of mounting a campaign.

“It’s just that – whisper it quietly – all is not what it seems.”

Post Office Horizon IT scandal
Mark Davies had praised former Post Office boss Paula Vennells (Anthony Devlin/PA)

After showing the inquiry further emails criticising media coverage, with one referencing the work of journalist Nick Wallis as “garbage”, counsel to the inquiry Julian Blake asked: “Email after email after email blaming the journalists, isn’t it?”

Mr Davies responded: “Well, with the benefit of hindsight, some of them look ludicrous, I agree.”

Mr Blake continued: “Had you ever asked yourself, might we in fact be the baddies?”

Mr Davies said: “I’ve asked myself that question, I’ve asked myself many, many questions on this issue many, many, many times over the course of the last few months, over the course of the last few years, and throughout the whole period I was dealing with these issues.

“We really believed we were doing the right things.

“We appointed Second Sight to lead an investigation which we thought was the right thing to do.

“We then created a mediation scheme because we wanted to give people the opportunity to raise the issues they had. We advertised for people to come forward to the scheme using our communication channels.

“We’d really tried, and the context is that we really believed that we tried to do the right things.”

Concluding his witness statement, Mr Davies denied he had sought to “cover up issues with Horizon”.

He said: “I did not, as been alleged, seek to ‘cover up’ issues with Horizon – indeed quite the opposite.

“But because I did not have access to all the facts, I clearly played a part in prolonging the pain and injustice for those innocent people who were wrongly accused or whose convictions were unsafe.

“I am deeply sorry for that.”

The Post Office has come under fire following the ITV drama Mr Bates Vs The Post Office, which put the Horizon IT scandal under the spotlight.

More than 700 subpostmasters were prosecuted by the Post Office and handed criminal convictions between 1999 and 2015 as Fujitsu’s faulty Horizon system made it appear as though money was missing at their branches.

Hundreds of subpostmasters are still awaiting full compensation despite the Government announcing those who have had convictions quashed are eligible for £600,000 payouts.