NSW Premier Barry O’Farrell says he had no choice but to resign after giving inaccurate evidence at a corruption inquiry about a $3000 wine gift.

Barry O’Farrell swept to power on a promise of cleaning up NSW politics only to be brought down by his own hand and a $3000 bottle of wine.

The premier, previously described as a political cleanskin, made the shock announcement on Wednesday morning that he would resign, before appearing at the corruption watchdog to admit that evidence he gave a day earlier was mistaken.

At issue was a bottle of 1959 Penfolds Grange Hermitage – a gift from Australian Water Holdings chief executive Nick Di Girolamo that, on Tuesday, Mr O’Farrell had insisted he had not received and knew nothing about.

On Wednesday morning, Mr O’Farrell’s handwritten note of thanks to Mr Di Girolamo for the wine – a gift marking his 2011 election win – was presented in evidence to ICAC.

The note read: “Dear Nick and Jodie. We wanted to thank you for your kind note & the wonderful wine. 1959 was a good year, even if it is getting even further away! Thanks for all your support. Kind Regards, Barry and Rosemary.”

Mr O’Farrell maintained he had no recollection of receiving the gift during the busy first weeks of forming a new government but he accepted the handwriting was his.

“This has clearly been a significant memory fail on my part,” he said.

But Mr O’Farrell had no choice but to resign.

“As someone who believes in accountability, in responsibility, I accept the consequences of my actions,” he told reporters.

The outgoing premier returned to ICAC where, in a 20-minute appearance, he repeated that he had no recollection of receiving the wine on April 20, 2011.

Under questions from counsel assisting the inquiry Geoffrey Watson, SC, Mr O’Farrell maintained he did not know about a call from his mobile to Mr Di Girolamo’s phone at about 9.30pm that night.

ICAC has heard that in 2011 Mr Di Girolamo was chief executive of Australian Water Holdings – a water infrastructure company with alleged secret links to corrupt ex-Labor MP Eddie Obeid.

Mr O’Farrell had been due to share the national stage with Prime Minister Tony Abbott on Wednesday to welcome visiting royals Prince William and Princess Kate and their son, Prince George.

Mr Abbott, who learned of Mr O’Farrell’s decision following a text message, said the NSW premier had “innocently” and “inadvertently” misled the inquiry and done the “utterly honourable” thing by stepping down.

“We are seeing an act of integrity and an act of honour,” he said.

NSW opposition leader John Robertson attacked the government, saying public confidence in the state’s politicians had been “rocked to the core”.

“What we see today is not about a bottle of wine,” he said.

“Today is an insight into how the Liberal Party operates in NSW.”

“They have allowed donors and lobbyists to get involved in the public administration of this state.”

Mr O’Farrell was elected to state parliament in 1995 and became premier in March 2011.

No corruption allegations have been levelled against Mr O’Farrell.

The outgoing premier said he expects to formally resign next week, when his replacement will be announced.

Treasurer Mike Baird and Transport Minister Gladys Berejiklian are considered frontrunners to become the 44th premier of NSW.