The desire to protect former First Minister Arlene Foster was the motivation behind changes made to an official document on the Renewable Heat Incentive, a public inquiry into the botched green energy scheme has heard.

During his second day of questioning from inquiry counsel David Scoffield, top civil servant Chris Stewart said there were moves to make it appear as though former Enterprise Minister Jonathan Bell was alone in being behind "the politically unpopular decision" to close the scheme without public consultation.

In a BBC interview in December 2016, Mr Bell had claimed that DUP advisers tried to "cleanse the record" by removing references to the DUP leader.

The paper in question was a submission from the start of February 2015 in which DUP special adviser Timothy Cairns had asked Mr Stewart to remove references to the First and Deputy First Ministers, saying that Mr Bell had "made the decision and no advice from other ministers or departments played a part in that".

Mr Stewart said he didn't know at the time that the request to remove the references was against Mr Bell's wishes - he had assumed it was being done with Mr Bell's permission and had not been told otherwise.

"I think there was a strategy emerging for Jonathan Bell to be front and centre on the decision-making on RHI," he said.

He admitted his subsequent decision to tell Mr Bell about the changes during a meeting in February 2016 had prompted an "obviously angry reaction".

Mr Stewart told the inquiry it then became "instantly clear" that Mr Bell had not made the request for the change to be made and his subsequent anger was "fully justified".

Mr Cairns had joined the meeting and when he was challenged by Mr Bell about the change he had suggested that Mr Stewart had lied to the minister.

"Tempers rose quickly," said Mr Stewart, adding that Mr Cairns then withdrew the "lied" claim.

Under further questioning, Mr Stewart objected to Mr Bell's characterisation of him during his interview on BBC with Stephen Nolan as someone who went to the minister as a "whistleblower", describing it as "simply wrong".

"You can only do that if you have the trust and confidence of all ministers and all parties," he said.

The inquiry also heard how panic had descended in December 2015 when it became clear the Treasury would not be picking up the bill for the failed scheme. After that point, RHI became a "full-blown crisis" as the race was on to close it.

Mr Scoffield said he has "no doubt" that some people would've had their "Christmases wrecked that year by what had happened and what needed to be done".

On New Year's Eve 2015, Mr Bell was told in a ministerial submission that he had "no choice but to close" the RHI scheme as soon as possible.

Mr Stewart said it was "decision time" for the minister and Mr Bell agreed to the closure at a meeting on January 11, 2016.

In contrast to the cost controls saga of the previous summer, he said Mr Bell's adviser Mr Cairns offered no resistance at that stage, but added: "It would have been a brave man or woman who would have opposed the rationale that we needed to close.

"I think we were all a bit shell-shocked at the situation we'd found ourselves in.

"I think there was a recognition on the minister's part and on Timothy's part as well that this was a very, very serious situation - it was a catastrophe."

The DUP had previously resisted the introduction of cost controls because it didn't want to "hobble" a scheme that it was being told was a good one.

Mr Stewart said that in a long career he'd never experienced "resistance" like it as officials tried to rein in spending.

"As the resistance went on I found it, and still find it, more and more difficult to have such a benign interpretation of it," he said.

Mr Stewart also said he was "dismayed" at learning that Moy Park had told its suppliers to "get in quickly" before the scheme shut.

Representatives from Moy Park will face the inquiry today.

Belfast Telegraph